≡ Menu

Ubuntu Linux Static IP Configuration

I have an Intel Corporation 80003ES2 LAN Gigabit Ethernet Controller. How do I set a static IP address settings for my Ubuntu Linux server as follows:
DEVICE name : eth0
Type: static

How do I setup a static IP address under a Ubuntu Linux 14.04 or 16.04 LTS server?

Ubuntu Linux server stores all network configuration options in /etc/network/interfaces configuration file. You need to open this file using a text editor such as vi or gedit or nano. In this tutorial you will learn how to assign a static IP to Ubuntu server operating system.

How to set a Static IP in Ubuntu Linux

Open the terminal command line application or ssh into remote server. Type the following command:
sudo vi /etc/network/interfaces
sudo nano /etc/network/interfaces
Make the changes as follows:

auto eth0
iface eth0 inet static
# Google dns server for our network

Save and close the file. Restart networking on Ubuntu Linux 14.04 LTS or older:
$ sudo /etc/init.d/networking restart
If you are using systemd based Ubuntu Linux version such as 16.04 LTS or above, enter:
$ sudo systemctl restart networking
Here is another configuration from one of my servers:

Fig.01: Ubuntu static config for eth0 and eth1 with static routing

Fig.01: Ubuntu static config for eth0 and eth1 with static routing

How do I verify a static IP configuration on Ubuntu?

To see new IP address, enter:
$ sudo ip a show
To see new routing table, enter:
$ sudo ip r
Try to ping a network IP or domain name:
$ ping
$ ping cyberciti.biz

Verify dns too:
$ host cyberciti.biz
$ dig google.com

A note about enabling an IPv6 static address on Ubuntu

Edit /etc/network/interfaces file, enter:
$ sudo vi /etc/network/interfaces
Append/edit as follows after inet (IPv4) config:

### Start IPV6 static configuration
iface eth0 inet6 static
#pre-up modprobe ipv6
address 2400:6180:100:d0::7c:c001
netmask 64
gateway 2400:6180:100:d0::1
dns-nameservers 2001:4860:4860::8888 2001:4860:4860::8844
### END IPV6 configuration

Restart the networking service:
$ sudo systemctl restart networking
Verify it as described here:
# ifconfig eth0
# ip -6 address show eth0
# ping6 google.com

See more Ubuntu Linux networking examples here.

Share this tutorial on:
{ 4 comments… add one }
  • JohnJune 22, 2009, 12:19 am

    Your missing the DNS entry in /etc/resolv.conf.

    nameserver XXX.XXX.XXX.XXX

  • gitanApril 3, 2013, 9:12 am

    Nice info .

  • IamJeffJuly 2, 2016, 11:43 pm

    Stop using “sudo vi” and use sudoedit instead. There is a shell escape in vi. Using sudoedit blocks that. That’s important if you are not the only user on a system. You can set your EDITOR or VISUAL environment variable to use either /usr/bin/vi or /usr/bin/nano automatically. I can never remember the difference between EDITOR and VISUAL, so I usually set them both to the same editor.

  • Linwood MurrufoJuly 31, 2016, 8:23 pm

    The nameservers and are provided by Google for public use, so you can use them in your network configuration.

Security: Are you a robot or human?

Leave a Comment

You can use these HTML tags and attributes: <strong> <em> <pre> <code> <a href="" title="">

   Tagged with: , , , , , , , , , , , , , , , , , , , ,