Home Ubuntu and Netplan
Post
Cancel

Ubuntu and Netplan

“Netplan” is a system to define the configuration for the network connection. Here are two examples: DHCP and fixed IP. The default configuration file is located at /etc/netplan/00-installer-config.yaml

DHCP

1
2
3
4
5
6
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens18:
      dhcp4: true
  version: 2

This is obviously the simplest configuration as the IP address, the gateway and DNS (nameserver) addresses come from the DHCP server.

Fixed IP Address

1
2
3
4
5
6
7
8
9
10
11
12
13
# This is the network config written by 'subiquity'
network:
  ethernets:
    ens18:
      addresses:
      - 192.168.1.5/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
        - 192.168.1.1
        search:
        - lan
  version: 2

After you have made a change, reboot or apply the settings.

1
sudo netplan apply
This post is licensed under CC BY 4.0 by the author.