Table of Contents
Ubuntu networking
18.04 netplan
Disable default gw multiple ifaces
According to this answer, it should be possible with dhcp4-overrides, however that is not supported in Ubuntu as of 18.04. My workaround was to create a hook script in /etc/networkd-dispatcher/routable.d/ to remove the default route:
#!/bin/sh # Only remove the default route on the second interface, e.g. eth1 [ "$IFACE" != eth1 ] && exit 0 # delete the default route for this interface ip route del default dev eth1