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

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 sxi.io

Verify dns too:
$ host sxi.io
$ 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.

Posted by: SXI ADMIN

The author is the creator of SXI LLC and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Leave a Reply

Your email address will not be published. Required fields are marked *

Previous Post

How to Make Website WCAG Compliant?

Next Post

Link download Kali Linux 2020.1 (ISO + Torrent)

Related Posts