Configure Ubuntu w/ Static IP

Filed under linux, quickie, security, and web.

Ubuntu Enterprise 6 seems to install as DHCP out-of-the-box. To change to a static ip, open the file /etc/network/interfaces. It should contain some lines like :

auto eth0
iface eth0 inet dhcp

Change this to something like :

auto eth0
iface eth0 inet static
address xxx.xxx.xxx.xxx
netmask xxx.xxx.xxx.xxx
network xxx.xxx.xxx.xxx
broadcast xxx.xxx.xxx.xxx
gateway xxx.xxx.xxx.xxx

where xxx.xxx.xxx.xxx are the appropriate IP addresses for your network. To restart the networking service, run :

$ sudo /etc/init.d/networking restart

If you enjoyed this post, please follow us on twitter or subscribe to our feed!