After a few days of trials and errors, I found out that at the moment, [netplan doesn't support macvlan bridge yet][5], we need a workaround and alter systemd
network:
- We need to create a few files on
/etc/systemd/network
, so navigate to the directory:
$ cd /etc/systemd/network
- Define vlans for the bridge, please change
cat
to your editor
$ cat 00-vmvlan0.netdev
[NetDev]
Name=vmvlan0
Kind=macvlan
# Optional MAC address, or other options
MACAddress=xx:xx:xx:xx:26:12
[MACVLAN]
Mode=bridge
$ cat 00-vmvlan0.network
[Match]
Name=vmvlan0
[Network]
Address=xxx.xxx.198.104/32
IPForward=yes
ConfigureWithoutCarrier=yes
$ cat 00-vmbr0.netdev
[NetDev]
Name=vmbr0
Kind=bridge
$ cat 00-vmbr0.network
[Match]
Name=vmbr0
[Network]
MACVLAN=vmvlan0
- repeat for the next IPs
- Link bridge, vlan, and interface:
$ cat 10-netplan-eno1.link
[Match]
MACAddress=xx:xx:xx:xx:19:d0
[Link]
Name=eno1
WakeOnLan=off
$ cat 10-netplan-eno1.network
[Match]
MACAddress=xx:xx:xx:xx:19:d0
Name=eno1
[Network]
DHCP=ipv4
LinkLocalAddressing=ipv6
MACVLAN=vmvlan0
MACVLAN=vmvlan1
MACVLAN=vmvlan2
MACVLAN=vmvlan3
[DHCP]
RouteMetric=100
UseMTU=true
- and we can use default netplan configuration:
$ sudo cat /etc/netplan/50-cloud-init.yaml
network:
version: 2
ethernets:
eno1:
dhcp4: true
match:
macaddress: xx:xx:xx:2a:19:d0
set-name: eno1