Linux IP address Configuration - ifconfig


2007-08-31 Digg! icurtain Delcious icurtain

ifconfig is the linux equivilent of ipconfig and will give you your ipaddress and network details :)

to edit it in red hat go into /etc/sysconfig/network-scripts/ifcfg-eth0 (where 0 is the interface u want to change) and append as desired. then from the command line:

service network [start,stop,restart]

In Ubuntu (Debian)

nano /etc/network/interfaces

Contents should be:

iface eth0 inet static
address 192.168.1.55
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1

Don't forget you need to resolve domain names..

sudo nano /etc/resolv.conf
nameserver 192.168.1.1 #where that's the name server ip

For DHCP it should read

auto eth0
iface eth0 inet dhcp

To restart your network interface and update settings

sudo /etc/init.d/networking restart