Static IP Configuration On Ubuntu 18.04 Server

We know the configuration of IP on Ubuntu 18.04 is different from other. Ubuntu versions like Ubuntu 14, Ubuntu 16 etc. The manner by which Ubuntu oversees organize interfaces has totally changed. We use NetPlan as the new network configuration tool to manage network settings in Ubuntu 18. NetPlan replaces the static interfaces “/etc/network/interfaces” document that had already been utilized to design Ubuntu organize interfaces.

In Ubuntu 18.04 we use,

/etc/netplan/*.yaml to configure interfaces instead of /etc/network/interfaces.

The new interfaces setup record can be found under the /etc/netplan directory. There are two renderers for this tool that is NetworkManager and networkd. NetworkManager renderer is generally utilized on personal computers and networkd on servers.

Configuring Static IP Addresses with Networkd

To Identify Active Network Interfaces on Ubuntu, Initially, we need to identify the network interface which we are going to set up. We can list all attached network interfaces on the server using the “ifconfig” or “ip a”command.

Note: In case a YAML file is not created by the distribution installer, we can generate the required configuration for the renderers with the following command,

” #netplan generate”

Even though auto-generated files have different file names, all files under /etc/netplan/*.yaml will be read by netplan.

  • To Set Static IP Address in Ubuntu 18.04

For this example, we consider interface “eth0” as the interface in which IP has to be configured.

Open the file under /etc/netplan by Vim or nano,

” #vim /etc/netplan/01-netcfg.yaml”

Then add the below configuration in the ethernet section that is under eth0.

eth0:
dhcp4: no
dhcp6: no
addresses: [192.***.**.8/29 ]
gateway4: 192.***.**.7
nameservers:
addresses: [8.8.8.8, 8.8.4.4]

Save the file and exit. Using netplan command, apply the recent network changes.

#netplan apply

  •  To verify IP configuration.

The eth0 ethernet interface will now connect to the local network and will be responding to ping.

#ifconfig -a
#ping 8.8.8.8

[tagline_box backgroundcolor=”description=” shadow=”no” shadowopacity=”0.7″ border=”1px” bordercolor=”” highlightposition=”top” content_alignment=”left” link=”” linktarget=”_self” modal=”” button_size=”” button_shape=”” button_type=”” buttoncolor=”” button=”” title=”” description=”If you have any queries on how to configure static IP on ubuntu 18.04 serverfeel free to leave us a message and our representative will get back to you.

” margin_top=”50px” margin_bottom=”” animation_type=”slide” animation_direction=”left” animation_speed=”0.3″ class=”” id=””]

    [/tagline_box]