29 June, 2008

Configuring Static ip address in Ubuntu server


Ubuntu installer has configured our system to get its network settings via DHCP, Now we will change that to a static IP address for this you need to edit. Edit /etc/network/interfaces and enter your ip address details (in this example setup I will use the IP address 172.19.0.10):


$: sudo vi /etc/network/interfaces

and enter the following save the file and exit


# The primary network interface

auto eth0
iface eth0 inet static
address 172.19.0.10
netmask 255.255.255.0
network 172.19.0.0
broadcast 172.19.0.255
gateway 172.19.0.1


Now you need to restart your network services using the following command

$: sudo /etc/init.d/networking restart


You need to setup manually DNS servers in resolv.conf file when you are not using DHCP.

$: sudo vi /etc/resolv.conf


You need to add look something like this

# search domain.com

# nameserver xxx.xxx.xxx.xxx

No comments: