I have set up an ovs bridge in order to take advantage of libvirt's virtual network with vlan support.
As recommended, the host network interface is configured on an ovs port, rather than directly on the bridge.
The host nic receives tagged and untagged traffic. The latter for the host's own interface. I also wish for that interface to have a specific MAC.
How to do the equivalent of ovs-vsctl set interface vlan0 mac=\"00:11:22:33:44:55\"
in netplan?
I am unsure how to target the ovs interface config within the vlan0 openvswitch:
section.
mac:
and other-config:hwaddr
are invalid/ineffective options for ovs port.
So far:
network:
version: 2
ethernets:
enp0s31f6: {}
bridges:
ovsbr0:
interfaces: [enp0s31f6]
openvswitch: {}
vlans:
vlan0:
id: 0
link: ovsbr0
openvswitch: {}
addresses: [192.168.0.11/24]
gateway4: 192.168.0.1
nameservers:
search: [home.lan]
addresses: [192.168.0.10]
Or is this not possible in netplan yaml and I should resort to networkd-dispatcher hook scripts?
EDIT: Using networkd-dispatcher and removing deprecated options, I now have this config, which works for me. It would be good to know if the additional openvswitch commands are supported inside netplan yaml config, to keep it all in one place.
- ubuntu 20.04.5
- openvswitch-switch 2.13.8-0ubuntu1.1
- netplan.io 0.104-0ubuntu2~20.04.2
#/etc/netplan/01-ovsbr0.yaml
network:
version: 2
renderer: networkd
ethernets:
enp0s31f6: {}
bridges:
ovsbr0:
interfaces: [enp0s31f6]
link-local: []
openvswitch: {}
vlans:
vlan0:
id: 0
link: ovsbr0
openvswitch: {}
addresses: [192.168.0.11/24]
routes:
- to: default
via: 192.168.0.1
nameservers:
search: [home.lan]
addresses: [192.168.0.10]
#!/bin/sh
#/etc/networkd-dispatcher/configuring.d/99-vlan0-mac.sh
IFACE_MATCH='vlan0'
MAC='00:11:22:33:44:55'
[ "$IFACE" = "$IFACE_MATCH" ] && /usr/bin/ovs-vsctl set interface $IFACE mac=\"$MAC\"