1

OVH cloud host allows an easy way to route multiple blocks of their IPs to virtual MACs on one interface. For example, eth0 has an address on the 40.30.20.0/24 network with a gateway of 40.30.20.254, but their router is setup to also route traffic for 45.35.25.15/32 to that same interface. My VM's are macvtap'd off the host interface, with this virtual MAC assigned. When I try to setup netplan, I use this config:

network:
  version: 2
  renderer: networkd
  ethernets:
    ens3:
      addresses:
        - 45.35.25.15/32
      gateway4: 40.30.20.254
    nameservers:
      addresses: [213.186.33.99]

Normally, that gateway4 piece should give me a default route, but since it's outside the subnet, it barfs. I can't find a specific error in the logs. After applying netplan, and even rebooting, my route command is blank (no routes at all). ifconfig shows the interface is up and configured, just no routes. It's the only interface on the VM (besides lo), and all it takes to fix it is sudo ip route add default dev ens3, so why can't netplan just add such an obvious route to the only interface?? This bug seems related, but never got addressed.

How do I use netplan to get a default route in this scenario?

  • oh, I guess in the linked bug the different subnet was a typo, whereas in my case it's legitimate... – QuickDanger Jun 08 '19 at 06:57
  • For now I just made a startup script to add the route - for anyone following along, see this answer for instructions: https://unix.stackexchange.com/questions/47695/how-to-write-startup-script-for-systemd – QuickDanger Jun 08 '19 at 07:05

0 Answers0