Setup Static IP In Ubuntu 14.04

Setup Static IP In Ubuntu 14.04

The following steps describes how I have configured my static IP address on Ubuntu Server 14.04.

You need to edit the file “/etc/network/interfaces”:

sudo  vi /etc/network/interfaces

Then change to include the following:

# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
auto eth0
#iface lo inet interface
iface eth0 inet static
  • eth0 is the regular ethernet interface
  • address is the static IP address you choose
  • gateway is usually the routers IP address
  • dns-nameservers is the dns server IP address, this is needed for domain name resolution

After the change you can either reboot or run

sudo ifdown eth0
sudo  ifup  eth0

Check now:

mel@ubuntu:~$ ifconfig 
eth0      Link encap:Ethernet  HWaddr 08:00:27:6a:56:94  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::a00:27ff:fe6a:5694/64 Scope:Link
          RX packets:1181 errors:0 dropped:0 overruns:0 frame:0
          TX packets:173 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:96894 (96.8 KB)  TX bytes:23376 (23.3 KB)
lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

  • Fahad Ahammed

    IPV4 … But what for IPV6 ??

  • mel

    # The loopback network interfaces
    auto lo
    iface lo inet loopback
    iface lo inet6 loopback

    # The wide area network interface
    auto wlan0
    iface wlan0 inet manual
    iface wlan0 inet6 static
    pre-up modprobe ipv6; wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant.conf
    post-down killall -q wpa_supplicant
    address 2002:xxxx:xxxx:xxxx::xxxx/64
    netmask 64 gateway 2002:xxxx:xxxx:xxxx:xx:xx:xx:xx
    dns-nameservers ::1

    # The local area network interface
    auto eth0
    iface eth0 inet manual
    iface eth0 inet6 static
    pre-up modprobe ipv6
    address fd51:xxxx:xxxx:xxxx::x/64
    netmask 64

  • Pingback: Static IP setup in Trusty | 0ddn1x: tricks with *nix()


    I prefer:
    Add: sudo ip ad ad dev eth0
    Del: sudo ip ad del dev eth0
    takes effect immediately


    For IPv6
    Add: sudo ip -6 ad ad 2001::1/64 dev eth0:1
    Del: sudo ip -6 ad del 2001::1/64 dev eth0:1

    : )

  • emce

    Ok, I ditched Microsoft and change my household computers and laptops to Ubuntu 14.04 :)

    After a week long searching the internet how to get a static ip-address on Ubuntu 14.04 I finally found a way …

    It seems the network-manager is overwriting (or by-passing) my /etc/network/interfaces every single time, I thought of removing it but decided on trying to use it first.

    Go to the right upper corner and click the network icon, go down to the bottom and right click edit connections.

    This opens network connections and choose the connection to change, click edit and go to IPv4 settings. Choose Method: Manual and then fill in the Address, Netmask and Gateway … and your desired DNS server.

    Just save and your done … it will change to the given static IP-address on the fly … even after reboot!!

    This might be an old thread, but after a week of searching I updated the 10 first hits in Google … hope to safe other people some time!!

    Take care!

  • Pingback: Setting up Ubuntu Server 14.04 LTS | Tony Merryfield()

  • Pingback: setting static IP ubuntu 14.04 | DL-UAT()

  • Pingback: Ubuntu IP add | samiyanto Online()