Skip to main content
Ubuntu

Static IP Address on Ubuntu 12.04

By October 2, 2013September 12th, 2022No Comments

The address configuration of Ubuntu tends to be a little different from other Linux distros; typically you would expect a individual configuration file for each interface in systems such as CentOS, RedHat and SUSE. With Ubuntu the configurations are combined into a single file,/etc/network/interfaces

During the install DHCP will be configured for you network connection but we can change this a letterly to a static IP address. To do this we would edit the /etc/network/interfaces and change the entry for the NIC to static from dhcp.

Once changed to static we must, of course configure the address information:

iface eth0 inet static
    address 192.168.10.3
    netmask 255.255.255.0
    gateway 192.168.10.1
    dns-search example.com
    dns-nameservers 8.8.8.8 8.8.4.4

Note: that we will now configure the DNS information in each network stanza to allow for different DNS servers based on different types of connections, ie LAN, wireless and 3G. This is preferred over setting single entries in the /etc/resolv.conf