What is Netplan?
How does it work?
How can I use it?
Configuration
network:
version: 2
renderer: NetworkManager
Commands Line
- netplan generate: /etc/netplan to generate the required configuration for the renderers.
- netplan apply: Apply all configuration for the renderers, restarting them as necessary.
- netplan try: Apply configuration and wait for user confirmation; will roll back if network is broken or no confirmation is given.
How to configure Netplan as DHCP
network:version: 2renderer: networkdethernets:enp3s0:dhcp4: true
How to configure Netplan as Static
network:
version: 2
renderer: networkd
ethernets:
enp3s0:
addresses:
- 10.10.10.2/24
nameservers:
search: [mydomain, otherdomain]
addresses: [10.10.10.1, 1.1.1.1]
routes:
- to: default
via: 10.10.10.1
How to configure Netplan as DHCP with multiple interface
network:version: 2ethernets:enred:dhcp4: yesdhcp4-overrides:route-metric: 100engreen:dhcp4: yesdhcp4-overrides:route-metric: 200
How to configure Netplan with an open wireless network
etwork:version: 2wifis:wl0:access-points:opennetwork: {}dhcp4: yes
How to configure Netplan with a WPA Personal wireless network
network:version: 2renderer: networkdwifis:wlp2s0b1:dhcp4: nodhcp6: noaddresses: [192.168.0.21/24]nameservers:addresses: [192.168.0.1, 8.8.8.8]access-points:"network_ssid_name":password: "**********"routes:- to: defaultvia: 192.168.0.1
How to configure Netplan with a WPA Enterprise wireless networks
network:version: 2wifis:wl0:access-points:workplace:auth:key-management: eapmethod: ttlsanonymous-identity: "@internal.example.com"identity: "joe@internal.example.com"password: "v3ryS3kr1t"dhcp4: yes
Or, if the network is secured using WPA-EAP and TLS:
network:
version: 2
wifis:
wl0:
access-points:
university:
auth:
key-management: eap
method: tls
anonymous-identity: "@cust.example.com"
identity: "cert-joe@cust.example.com"
ca-certificate: /etc/ssl/cust-cacrt.pem
client-certificate: /etc/ssl/cust-crt.pem
client-key: /etc/ssl/cust-key.pem
client-key-password: "d3cryptPr1v4t3K3y"
dhcp4: yes
It have different mode of encryption are supported. see the Netplan reference more detail
How to configure Netplan with multiple address on a single interface
network:version: 2renderer: networkdethernets:enp3s0:addresses:- 10.100.1.38/24- 10.100.1.39/24routes:- to: defaultvia: 10.100.1.1
How to configure Netplan with multiple address and multiple gateways
network:version: 2renderer: networkdethernets:enp3s0:addresses:- 10.0.0.10/24- 11.0.0.11/24routes:- to: defaultvia: 10.0.0.1metric: 200- to: defaultvia: 11.0.0.1metric: 300
as we known default route or 0.0.0.0/0 using the address of the gateway for the subnet.