Setup Static IP In Ubuntu 14.04

by
Share this Article: Facebook415Google+0Twitter15LinkedIn0Reddit0StumbleUpon1

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
address 192.168.1.122
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 8.8.8.8 8.8.4.4
~                               
  • 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:192.168.1.122  Bcast:192.168.1.255  Mask:255.255.255.0
          inet6 addr: fe80::a00:27ff:fe6a:5694/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          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:127.0.0.1  Mask:255.0.0.0
          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)

For questions please refer to our Q/A forum at : http://ask.unixmen.com/

Share this Article: Facebook415Google+0Twitter15LinkedIn0Reddit0StumbleUpon0