Static IP Address on Ubuntu 18.04 with netplan

Ubuntu replaced the configuration file /etc/network/interfaces with netplan, which uses configuration files in YAML syntax /etc/netplan/01-netcfg.yaml .

Open the YAML configuration file with your text editor :

sudo nano /etc/netplan/01-netcfg.yaml
/etc/netplan/01-netcfg.yaml
network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      dhcp4: yes
    ens4:
      dhcp4: no
      addresses:
        - 192.168.121.99/24
      gateway4: 192.168.121.1
      nameservers:
          addresses: [8.8.8.8, 1.1.1.1]

 

Once done save and close the file and apply the changes with:

sudo netplan apply

Verify the changes by typing:

ip addr show dev ens3

 

Leave a Reply

Your email address will not be published. Required fields are marked *