Quick Tip: Netplan Route Metrics

In case you require to add different metric values to a netplan config you can see how to do this here.

Quick Tip: Netplan Route Metrics
Photo by Compare Fibre / Unsplash

In case you require to add different metric values to a netplan config you can see how to do this below:


network:
    ethernets:
        enp1s0:
            [...]
            dhcp6: yes
            dhcp6-overrides:
              route-metric: 100
            [...]
        enp0s31f6:
            [...]
            dhcp6: yes
            dhcp6-overrides:
              route-metric: 10000
            [...]
    version: 2


There are only the parts regarding the metrics shown, further netplan config is still required. A full config could be:


network:
    ethernets:
        #10G NIC - Uplink
        enp1s0:
            match:
              macaddress: 00:1b:21:bb:99:99
            addresses:
              - 10.10.10.10/24
            dhcp4: no
            dhcp6: yes
            dhcp6-overrides:
              route-metric: 100
            routes:
              - to: 0.0.0.0/0
                via: 10.10.10.1
            nameservers:
              addresses: [10.10.10.1]
        #1G NIC - WoL only
        enp0s31f6:
            match:
              macaddress: 4c:52:62:21:99:99
            addresses:
              - 192.168.192.168/32
            dhcp4: no
            dhcp6: yes
            dhcp6-overrides:
              route-metric: 10000
            wakeonlan: true
    version: 2