Date created: Friday, March 25, 2022 10:21:25 AM. Last modified: Wednesday, February 21, 2024 5:02:48 PM

netplan

References:

https://netplan.readthedocs.io/en/latest/netplan-yaml/

 

Basic Config

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