Ubuntu Static IP

Edit /etc/network/interfaces

# This file describes the network interfaces available on your system
# and how to activate them. For information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet dhcp

Comment out the “iface eth0 inet dhcp” line, and add

iface eth0 inet static
  address <desired static IP address>
  netmask <mask (e.g.>
  network <network (e.g.>
  broadcast <network broadcast address (e.g.>
  gateway <network (e.g.>

Save the file and restart networking
sudo /etc/init.d/networking restart