Set static ip--how to set for Ubuntu in Ubuntu Server 16.04

Source: Internet
Author: User



How to set the static IP address in Ubuntu Server 16.04

It is really important to know what to configure static IP address on Ubuntu Server, Because It's almost impossible to run A-server without a static IP address.

During the installation, Ubuntu Server by default configured to use dynamic IP address. In this Tutorial we is going to learn what to set the static IP address in Ubuntu Server 16.04.

Following is the steps we is going to follow

    • Check Available Network interfaces on Ubuntu Server 16.04
    • ADD static IP configuration to the network configuration file.
    • Restart Ubuntu Networking Service.
Check Available Network Interfaces on Ubuntu Server

First of all, need to get the list of available network interfaces on your Ubuntu Server 16.04. We can use the IP link Show command to the find available network interfaces on Ubuntu Linux.

IP link Show

You should get the similar output as below screenshot shows.

IP add command list Network Interfaces

As above image shows, our Ubuntu Server has Ethernet interfaces called Enp0s3. Next we ll set static IP address to the ENP0S3 interface.

Set static IP address to the network interface

For the example I am going configure ENP0S3 Ethernet interfaces with following IP configuration

IP address =

Network mask =

Default gateway =

DNS Server = and

On Ubuntu server, in order to set the static IP address we need to the add IP configuration to the/etc/network/interfaces file. So open the/etc/network/interfaces file using a command line text editor (you can use Vim or nano on Ubuntu Server).


Then set static IP address as follows.

First line of configuration should is the word "auto" followed by the interface name (this brought the network INTERFAC e automatically when the system boot or when networking restart).

Auto ENP0S3

The next line should specify whether to use a static IP address or DHCP IP on the ENP0S3 network interface. In we case it should is static.

Auto ENP0S3

Iface enp0s3 inet Static

Then add the static IP configuration as follows.

Auto ENP0S3

Iface enp0s3 inet Static





Restart Networking Service

After setting-IP Configuration, we need to restart Ubuntu networking service.

sudo ip addr flush enp0s3 && sudo systemctl restart Networking.service

Verify the static IP configuration.

After restarting network, use IP Add command to make sure this static IP address have been assigned to the network INTERFAC E.

IP add

Then send an ICMP request to a remote host to check the connectivity.

Ping-c 4

Configure multiple Network Interfaces

Same-Configure multiple network interface on Ubuntu server Using/etc/network/interfaces file.


In the following example, I has set static IP address on the network interfaces (ENP0S3 and ENP0S8).

Auto ENP0S3

Iface enp0s3 inet Static





Auto ENP0S8

Iface enp0s8 inet Static



Most important thing when configuring multiple interface are you cannot set multiple default gateways. Only one interface should configure with the default gateway. For other interfaces should add default gateway using static routes.

Summary:set Static IP Ubuntu Server 16.04

In this tutorial we learned what to set static IP address in Ubuntu server 16.04.

    • Using IP Link Show command we identified the available network interface in our Ubuntu server 16.04.

Set static ip--how to set for Ubuntu in Ubuntu Server 16.04

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.