Entry
Linux: IP address: Set: How to set your IP address + gateway + DNS (from the console command line)?
Oct 15th, 2003 14:17
Knud van Eeden,
----------------------------------------------------------------------
--- Knud van Eeden - Sunday 10 August 2003 - 08:12 pm ----------------
Linux: IP address: Set: How to set your IP address + gateway + DNS
(from the console command line)?
Note:
You must be logged in as root:
type the command:
su
and supply the root password
---
---
Note: your first ethernet network card should be eth0, your second
eth1, your third eth2, ...
---
---
To see the ifconfig manual page, type:
man ifconfig
e.g.
ifconfig -a should give you the host's IP address
ifconfig <interface> inet 192.168.0.1 netmask 255.255.255.0 should put
the above IP and netmask on the interface <interface> (e.g. eth0 if
it's a REALTEK 8029 network adapter).
netstat -n should give you the ip addresses on the subnet (or any)
---
---
Method: use the 'ifconfig' command:
[Internet: source: http://www.experts-
exchange.com/Operating_Systems/Linux/Q_20412255.html]
In a console, type the command:
/sbin/ifconfig <your ethernet card identifier> inet <your new IP
address> netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.0.10, of one of your network
cards, type:
/sbin/ifconfig eth0 inet 192.168.0.10 netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.1.45 of another network card,
type:
/sbin/ifconfig eth1 inet 192.168.1.45 netmask 255.255.255.0
---
e.g. to change the IP address to 192.168.1.45 of a third network card,
type:
/sbin/ifconfig eth2 inet 192.168.1.45 netmask 255.255.255.0
---
Note: if you get the error:
'mask: Host name lookup failure'
possibly just ignore it for the moment.
---
To check which network card you need to choose, and if the IP address
has changed, type:
/sbin/ifconfig
---
---
Method: Directly change the ifcfg-eth0 file (disadvantage: you have to
reboot)
Steps: Overview:
1. -First create a backup of the original Ethernet card configuration
file:
cp /etc/sysconfig/network-scripts/ifcfg-
eth0 /etc/sysconfig/network-scripts/ifcfg-eth0_bak
2. -Now edit your configuration file:
vi /etc/sysconfig/network-scripts/ifcfg-eth0
3. -Possibly make some changes:
e.g. change the line
IPADDR=<your IP address>
4. -Save the changes
e.g. in vi type
to start changing:
<INSERT>
when finished type:
<ESCAPE>
:save /etc/sysconfig/network-scripts/ifcfg-eth0
to quit type:
<ESCAPE>
:q
5. -Reboot your machine
---
---
Linux Red Hat v9:
Method: use the 'setup' command:
In a console, type the command:
setup
This will open a window showing:
o Authentication configuration
o Firewall configuration
o Mouse configuration
o Network configuration
o Printer configuration
o System services
o Timezone configuration
Then choose 'network configuration' and supply
the data (e.g. another IP address)
---
---
Method: GUI:
Linux: Red Hat v9:
Steps: Overview:
1. -Click on Red Hat icon
2. -select from list 'System settings'
3. -select from list 'Network'
4. -that will open a box 'redhat-network-config'
5. -select tab 'Devices'
6. -click on line 'eth0' to highlight it
7. -select from menu option 'Edit'
8. -make the possible changes
(e.g. other IP address)
9. -click button 'Activate'
---
Internet: see also:
Windows XP: IP address: Set: How to set your IP address + gateway +
DNS from the MSDOS command line?
http://www.faqts.com/knowledge_base/view.phtml/aid/23652/fid/868
----------------------------------------------------------------------