Prerequisites

Configure Static IP Address

https://netplan.io/

Step 1: Get the Ehternet Interface Name

return the ethernet interfaces names

ip link

eth0:

or we can install ‘ifconfig’ tools by executing the following commands

sudo apt install net-tools

enp0s25

Netplan configuration files are stored in the /etc/netplan directory.

vim /etc/netplan/00-installer-config.yml


The device type can be ethernets, bonds, bridges, or vlans.

two Spaces are used for indentaion and make sure dhcp is indented after ethernet interface name.

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      dhcp4: no
      addresses:
        - 192.168.121.221/24
      gateway4: 192.168.121.1
      nameservers:
        addresses: [8.8.8.8, 1.1.1.1]

Once done, save the file and apply the changes by running the following command:

sudo netplan apply

ip addr show dev eth0

Previous
Next