Friday, July 23, 2021

Netplan config

sysadm@linuxtechi:~$ sudo vi /etc/netplan/00-installer-config.yaml

# This is the network config written by 'subiquity'

network:

  ethernets:

    enp0s3:

      dhcp4: true

  version: 2

Above are the default entries, which shows that interface “enp0s3” is getting the IP from DHCP server. As it is an yaml file, so while making the changes in the file we must follow correct indentation. Add the following lines to the yaml file,


network:

  ethernets:

    enp0s3:

      addresses: [192.168.1.3/24]

      gateway4: 192.168.1.1

      nameservers:

        addresses: [4.2.2.2, 8.8.8.8]

  version: 2