In Ubuntu Server, configuring network interfaces is surprisingly straight-forward. As opposed to other Linux distributions, where there is a configuration file per each interface (which can be hard to manage), there is only one network interface configuration file in Ubuntu:

/etc/network/interfaces

Here is a basic example:

# The loopback network interface
auto lo
iface lo inet loopback

# Built-in NIC, port 1
auto em1
iface em1 inet dhcp

As you can see, the loopback interface and only one NIC port is defined, which is using DHCP. This file will be automatically populated when the OS is installed.

Say that you want to change from DHCP to a static IP address. How do you do it? Easy, though there is an extra step that may not be obvious:

1. Edit config file to look like this:

# The loopback network interface
auto lo
iface lo inet loopback

# Built-in NIC, port 1
auto em1
iface em1 inet static
address 192.168.1.7
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.254 # Your DNS server, if any
dns-search dlr.com # Your DNS search domain, if any

2. Restart networking service:

$ sudo /etc/init.d/networking restart

If using 12.04 or earlier, ignore the 'deprecated' warning message. If using 12.10 or later, you can instead use:

$ sudo restart networking

3. Shutdown the dhclient daemon, otherwise you will get an IP address from DHCP when the lease is renewed, regardless of what's specified in the configuration file:

$ sudo killall dhclient
$ sudo apt-get -y purge isc-dhcp-client