Configure static IP on Ubuntu

This procedure will work many version of Ubuntu. I personally tested this on all Ubuntu versions from 12 and up, and should also work fine, or be a very good indicator of what to do, on any Debian based Linux distribution.

Like many OS out there, right after installation, everything is configured to use DHCP. Unless you have configured a static IP during the install process. This post will not cover this.

So first thing to do, once logged in you brand new OS, edit the network configuration file;

The file should look something like this:

Now, comment the “iface eth0 inet dhcp” line, and add all parameters to configure your interface manually. It should look like this:

Change any parameter in there to suit your desired configuration.

You are done ! You can “reboot” for you settings to take effect, but that is a “Windows Admin” habit.

If you are in luck and using a common OS like Ubuntu 14+ You can do this for the IP to kick in without rebooting:

 

JohnyLuky has written 54 articles

One thought on “Configure static IP on Ubuntu

  1. OnlyMe says:

    For setting DNS, you can also do this:
    Edit /etc/resolvconf/resolv.conf.d/base
    Paste:
    domain mydomain.com
    search mydomain.com
    nameserver 192.168.1.2
    nameserver 192.168.1.3

    Update resolvconf:
    sudo resolvconf -u

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">