Netplan Examples

From KHicks
Jump to: navigation, search

Here are some quick examples of Netplan on Ubuntu >= 17.04.

/etc/netplan/01-netcfg.yaml

DHCP

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

Static address

network:
  version: 2
  renderer: networkd
  ethernets:
    eth0:
      addresses:
        - 192.168.1.20/24
      gateway4: 192.168.1.1
      nameservers:
        search:
          - example.com
        addresses:
          - 192.168.1.1