Date created: Friday, March 25, 2022 10:21:25 AM. Last modified: Sunday, September 8, 2024 12:08:50 PM
netplan
References:
https://netplan.readthedocs.io/en/latest/netplan-yaml/
Basic Config
Check if netplan is managing interfaces (in this example the interfaces are managed via NetworkManager:
$sudo netplan status Online state: offline DNS Addresses: 127.0.0.53 (stub) DNS Search: . * 1: lo ethernet UNKNOWN/UP (unmanaged) MAC Address: 00:00:00:00:00:00 Addresses: 127.0.0.1/8 ::1/128 * 2: eth0 ethernet UP (unmanaged) MAC Address: 00:1e:06:42:03:e0 Addresses: 192.168.58.2/27 2003::xxx/64 fe80::xxx/64 (link) Routes: default via 192.168.0.1 metric 100 (dhcp) 192.168.0.0/24 from 192.168.0.2 metric 100 (link) 2003::/64 metric 100 (ra) fe80::/64 metric 1024 default via fe80::aaaa metric 100 (ra) $ nmcli device DEVICE TYPE STATE CONNECTION eth0 ethernet connected Wired connection 1 docker0 bridge connected (externally) docker0 lo loopback unmanaged
Get the current running config:
$ netplan get
network:
version: 2
ethernets:
eth0:
match:
macaddress: "00:1e:06:42:03:e0"
addresses:
- "192.168.0.10/24"
- "fd:0:0:0::10/64"
dhcp4: false
dhcp6: true
set-name: "eth0"
routes:
- to: "default"
via: "192.168.0.254"
Example netplan config belows gets an IPv4 and IPv6 address via DHCP, but also has a static v4 and v6 address:
$ cat /etc/netplan/10-default.yaml network: version: 2 ethernets: eth0: dhcp4: true dhcp6: true
accept-ra: false
mtu: 9000 match: macaddress: 22:22:33:44:55:66 set-name: eth1 addresses: - 10.0.0.8/24 - fd:0:0:1::8/64
routes:
- to: 192.0.2.1/32
via: 10.0.0.1
#vlans:
# eth0.123:
# id: 123
# link: eth0
# addresses:
# - 10.0.123.8/24
LAG Bundle
Configure an 802.3ad LACP bundle with 1 second "fast" LACP PDU interval:
network: version: 2 ethernets: enp11s0f1: dhcp4: false dhcp6: false accept-ra: false ens1f0: dhcp4: false dhcp6: false accept-ra: false bonds: bond0: dhcp4: false dhcp6: false accept-ra: false interfaces: - ens1f0 - enp11s0f1 macaddress: "3c:fd:fe:a9:35:10" parameters: mode: 802.3ad lacp-rate: fast mii-monitor-interval: 100 min-links: 1 transmit-hash-policy: layer2+3
Previous page: Mobile Internet / WWAN / mmcli
Next page: Networking Commands