Home Using Netplan
Post
Cancel

Using Netplan

Netplan is a new network card configuration method. The configuration files are stored at /etc/netplan as YAML files. Normally you have to edit these files to change from static to DHCP addresses

Examples of Netplan YAML files

DHCP4:

1
2
3
4
5
network:
  ethernets:
    ens18:
      dhcp4: true
  version: 2

Static:

1
2
3
4
5
6
7
8
9
10
11
12
network:
  ethernets:
    ens18:
      addresses:
      - 192.168.1.44/24
      gateway4: 192.168.1.1
      nameservers:
        addresses:
        - 192.168.1.1
        search:
        - lan
  version: 2

Static v2:

1

NOTE: The actual ethernet name can be different as will the IP addresses.

Before September 2021, if you needed to change anything you needed to modify these settings by name or by using something like sed. Now there is a command called ‘netplan set’ that take key=value pairs. This new command is not documented well. To use this command, you will needed to know the name for you network interface. here is one option:

1
ip a | grep "inet " | grep "brd" | rev | cut -d " " -f1 | rev

in progress

This post is licensed under CC BY 4.0 by the author.