Set IP static on Ubuntu 20.04 LTS Server with netplan

Set IP static on Ubuntu 20.04 LTS Server with netplan

In this Tutorial, we want to set IP static on ubuntu 20.04 LTS Server with netplan.

Netplan enables easily configuring networking on a system via YAML files. Netplan processes the YAML and generates the required configurations for either NetworkManager or systemd-network the system’s renderer.

Ok. Now In the following, we will consider about set IP static on ubuntu 20.04 manually.

 

Set IP static on Ubuntu 20.04 LTS Server with netplan

check Interface name

In first the first step, we have to check all interfaces on the ubuntu 20.04 LTS server. We Enter the below command for getting NIC name.

ip addr

when you enter the command, you can see your interface name. and we need the name for network configuration later.

set ip static on ubuntu 20.04 lts server -1

 

Set the IP address on ubuntu 20.04 server

Go to /etc/netplan directory and check the name of YAML file.

cd /etc/netplan

after that, you can use the ls command to see YAML file.

ls

ok, now it’s time to set IP static on ubuntu 20.04 LTS Server.

Sudo nano 00-installer-config.yaml

Remember: please edit your yam file.

Type your Static IP and other information like this

network
     ethernets:
       ens160:
        dhcp4: no
          addresses: [192.168.100.120/24]
          gateway4: 192.168.100.1
          nameservers:
            addresses: [8.8.8.8, 1.1.1.1]
        dhcp6: no
     version: 2

please attention below picture, you will see some space and some rule. Please consider it. If you don’t consider rules, netplan can’t detect your configuration.

After adding IP static and other information on the file, save, and exit.

Point: you could save and exit with Ctrl + x key and press Enter key twice.

set ip static on ubuntu 20.04 lts server -2

 

Apply configuration with the following command.

sudo netplan apply

Ok, now you can check Network configuration by ping your IP or ip addr command.

set ip static on ubuntu 20.04 lts server -3

 

Conclusion

In this article, we try to set an IP static on ubuntu 20.04. If you have any questions about this post, you can comment below or ask your question on the Eldernode Ask page.

Also, you could see the video on the Eldernode Youtube channel.

 

Use of this Site is subject to express terms of use. By using this site, you signify that you agree to be bound by these