Changing from DHCP to statically assigned IP address on Ubuntu Server 8.10

Published on Tuesday, 31 March 2009.

To change to a statically assigned IP address on Ubuntu 8.10

sudo vi /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
iface eth0 inet static
    address 172.16.1.77
    netmask 255.255.0.0
    network 172.16.0.0
    broadcast 172.16.255.255
    gateway 172.16.0.1
sudo /etc/init.d/networking restart

After you do this, there may be a few minute delay before you can connect. May need to do a full reboot if services don't respond. If your DNS servers were set by DHCP, then you /etc/resolv.conf file should be set correctly, so that on a reboot it should be ok. But if you are not get good DNS name resolution, then this may be the cause.