Skip to content

Instantly share code, notes, and snippets.

@dunderrrrrr
Created February 21, 2020 13:34
Show Gist options
  • Save dunderrrrrr/be5f7986e6fefa4da1220e112c0c18a9 to your computer and use it in GitHub Desktop.
Save dunderrrrrr/be5f7986e6fefa4da1220e112c0c18a9 to your computer and use it in GitHub Desktop.
Netplan is a utility for easily configuring networking on a linux system.

Netplan is a utility for easily configuring networking on a linux system. You simply create a YAML description of the required network interfaces and what each should be configured to do. From this description Netplan will generate all the necessary configuration for your chosen renderer tool.

Netplan reads network configuration from /etc/netplan/*.yaml which are written by administrators, installers, cloud image instantiations, or other OS deployments. During early boot, Netplan generates backend specific configuration files in /run to hand off control of devices to a particular networking daemon.

Example Static IP

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: no
      addresses: [10.1.1.10/24]
      gateway4: 10.1.1.1
      nameservers:
         search: [mydomain, otherdomain]
         addresses: [10.1.1.50, 10.1.1.51]
      optional: true

Example DHCP

network:
  version: 2
  renderer: networkd
  ethernets:
    eno1:
      dhcp4: yes

Reload netplan and activate changes.

$ sudo netplan --debug apply
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment