Below are a collection of example netplan configurations for common scenarios. If you see a scenario missing or have one to contribute, please file a bug against this documentation with the example using the links at the bottom of this page. Thank you!
To configure netplan, save configuration files under
/etc/netplan/ with a
/etc/netplan/config.yaml), then run
sudo netplan apply. This command parses and applies the configuration to the system. Configuration written to disk under
/etc/netplan/ will persist between reboots.
Using DHCP and static addressing
To let the interface named ‘enp3s0’ get an address via DHCP, create a YAML file with the following:
network: version: 2 renderer: networkd ethernets: enp3s0: dhcp4: true
To instead set a static IP address, use the addresses key, which takes a list of (IPv4 or IPv6), addresses along with the subnet prefix length (e.g. /24). Gateway and DNS information can be provided as well:
network: version: 2 renderer: networkd ethernets: enp3s0: addresses: - 10.10.10.2/24 gateway4: 10.10.10.1 nameservers: search: [mydomain, otherdomain] addresses: [10.10.10.1, 220.127.116.11]