Jun 9, 2012
tom

Ubuntu 12.04 Server static ip configuration

Question

I had some trouble getting the static ip configuration right for Ubuntu 12.04 Server. Every time I would restart the server the nameserver settings in /etc/resolv.conf would get overwritten by dhcp client. Many tutorials suggest doing an apt-get remove for dhcp-client but this didn’t work for me either.

I found this page that documents how to do this in 12.04.

Answer:

You basically need to add your nameserver settings in the /etc/network/interfaces file like so:

iface eth0 inet static
        address xx.xx.xx.xx
        netmask xx.xx.xx.xx
        network xx.xx.xx.xx
        broadcast xx.xx.xx.xx
        gateway xx.xx.xx.xx
        dns-nameservers xx.xx.xx.xx xx.xx.xx.xx

Note that dns-nameservers is where you add your DNS nameservers (they didn’t get creative with the name, heh!)

Asked by Jason

Answer

Unless they changed a lot in the latest version of Ubuntu static IPs should work just fine with the dhcp-client. Also I’d leave it on the machine in case you have to get a new dynamic IP.

But to answer your question :

If you read the package description (http://packages.ubuntu.com/precise/dhcp-client) it says :

Packages providing dhcp-clientdhcpcd5
    RFC2131 compliant DHCP client with IPv4LL support
pump
    BOOTP and DHCP client for automatic IP configuration 

Which means that dhcp-client is in fact one of those packages. Usually it is dhcpd5. So you only have to :

sudo apt-get remove dhcpcd5
Answered by tmn29a

Related posts:

  1. Ubuntu server static IP from install
  2. Setting up a static IP address (public) in Ubuntu
  3. Issues with static IP (Ubuntu Server 10.04)
  4. Server is losing its static IP address
  5. Permanently change DNS settings in Ubuntu Server

Leave a comment