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.
addresses: [192.***.**.8/29 ]
addresses: [18.104.22.168, 22.214.171.124]
Save the file and exit. Using netplan command, apply the recent network changes.
- To verify IP configuration.
The eth0 ethernet interface will now connect to the local network and will be responding to ping.
” margin_top=”50px” margin_bottom=”” animation_type=”slide” animation_direction=”left” animation_speed=”0.3″ class=”” id=””]