Setting up a static ip address in ubuntu 18.04 LTS is completely different than the previous versions. The ip configuration file name and locations are also changed. Ubuntu 18.04 LTS use “netplan” command for managing interfaces and ip address. This article explains how to set static ip ubuntu 18.04.
Set static ip Ubuntu 18.04
The configuration file which you need to edit is located as /etc/netplan/50-cloud-init.yaml. You have to edit this .yaml configuration file in order to manage interfaces and static ip addresses etc on your Ubuntu server. The default interface name is ‘end33’ for me (Ubuntu 18.04 LTS). Was set to dhcp mode by default.
The below screenshot shows the default configuration of /etc/netplan/50-cloud-init.yaml (interface: ens33 ; ip address: DHCP)
[email protected]:~# vi /etc/netplan/50-cloud-init.yaml
Note: take an extra care about the spacing of each configuration lines. otherwise you will get errors and configuration will not work.
Save the /etc/netplan/50-cloud-init.yaml file and run the below command to take effect the ip configuration changes immediately.
[email protected]:~# netplan apply
[email protected]:~# ifconfig //to view complete ip details//
Read linux related articles