To set a static IP address for for Ubuntu Precise Pangolin (12.04) LTS you need to edit the file /etc/network/interfaces to suit your network environment. In this example I will be using the 192.168.0.0/24 IP range with DNS Servers located at 192.168.0.1 and 192.168.0.2. The gateway is at 192.168.0.254. Be sure to change “domain.local” to match your domain or remove the line.
$ 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 192.168.0.20 netmask 255.255.255.0 network 192.168.0.0 broadcast 192.168.0.255 gateway 192.168.0.254 dns-nameservers 192.168.0.1 192.168.0.2 dns-domain domain.local