I'm running KVM on bare metal Ubuntu 20.04, and in order to get guest to host networking functional, I added a macvlan interface. I added a script under /etc/networkd-dispatcher/routable.d/10-macvlan-interfaces.sh
to create the macvlan interface on boot up, which seems to work.
#! /bin/bash
ip link add macvlan0 link enp35s0 type macvlan mode bridge
If I manually get rid of all of the routes, and add a route like this sudo ip route add default via 10.0.0.17 dev macvlan0 proto static
and my guest to host networking works as desired.
When I reboot though, something seems to be adding 2 routes that I need to delete to get my guest - host network functioning again. I can manually delete these 2 routes, and everything works fine again.
default via 10.0.0.17 dev macvlan0 proto static metric 100
10.0.0.0/24 dev enp35s0 proto kernel scope link src 10.0.0.17
10.0.0.0/24 dev macvlan0 proto kernel scope link src 10.0.0.17
My question is what exactly is causing these routes to be added?
My netplan config looks like this:
network:
ethernets:
macvlan0:
dhcp4: false
addresses: [10.0.0.17/24]
routes:
- to: 0.0.0.0/0
via: 10.0.0.17
metric: 100
nameservers:
addresses: [10.0.0.1]
enp36s0:
dhcp4: true
enxbe1c12c3a520:
dhcp4: true
enp35s0:
dhcp4: false
addresses: [10.0.0.17/24]
#gateway4: 10.0.0.1
nameservers:
addresses: [10.0.0.1]
version: 2
Ideally I would like to get it to boot up and only have the first default route. Any help would be greatly appreciated!