[14:41] <timss> I've been trying to configure a dual interfaced 18.04 server (Netplan 0.99), both with DHCP and a default GW. I'd like traffic that enters on a nic to leave on the same one. Adding `ip rule` and `ip route` to a new iproute2 table as shown here[1] works, but how would this translate to Netplan?
[14:41] <timss> [1]: https://unix.stackexchange.com/a/23345
[14:45] <slyon> timss: Right, you cannot define two default GW in netplan as there will be a conflict. So you need to define the static routes and routing policy manually, according to: https://netplan.io/reference/#routing
[14:46] <slyon> routes = "ip route" / routing-policy = "ip rule"
[14:51] <timss> That's helpful, thanks. If any routes are defined, are DHCP supplied DHCP default GW ignored for that given interface, or would you have to use dhcp4-overrides for that?
[14:52] <slyon> No. You'd need dhcp4-overrides.use-routes=false as well.
[14:52] <timss> Cheers, I'll have another go then
[14:53] <slyon> Have fun :)
[15:08] <timss> In the stackexchange answer there's a default gw added to the isp2 rt_table (ip route), how should the routes section look to do the same? I don't necessarily know what subnets the incoming packets are coming from as they are not on this LAN
[15:31] <slyon> I think you should be able to use 0.0.0.0/0 as the default subnet
[15:58] <mike40303> hello - I have an instance in google cloud that needs a route on the 2nd nic.   I have the yaml file in /etc/netplan modified so that it adds the routes when I run a netplan apply but the route is not there on boot.  No errors when I run the netplan apply and the route is added, but I need the route on boot to mount vi fstab.  Any suggestions on
[15:58] <mike40303> how to troubleshoot?
[16:05] <slyon> mike40303: do you have DHCP enabled? maybe you need dhcp4-overrides.use-routes=false?
[16:10] <mike40303> I will try that, but I did set the IP static as /32 but then I added the two routes that are present on the first nic:  to:   10.150.0.1  via 0.0.0.0   and  to 10.106.0.0/24  via 10.150.0.1.   When I run the netplan apply I see "ens5: Configured" in the area I was having issues before I got the routes correct.
[16:58] <mike40303> any time I use dhcp I get ens5: Could not set route: Network is unreachable.  If I set the IP static the same routes do not show an error when netplan apply is ran.
[17:01] <slyon> mike40303: where do you get this error message, i.e. running which command?
[17:01] <slyon> also, the route is still there in your /etc/netplan/*.yaml file after reboot, correct? And if you run 'netplan apply' after reboot the route is working again?
[17:09] <mike40303> when I run netplan apply I see the ens5: Confirgured or the Network in unreachable on the serial console.  yes, the route is still in the yaml file but not in the routing table on a reboot.   If I run netplan apply the route is then in netstat -nr.
[17:10] <slyon> what version of netplan and operating system are you using?
[17:11] <mike40303> 1.10.1-5build1 on ubuntu 18.04
[17:12] <slyon> 1.10.1-5build1 seems to be the "netplan" deb (unrelated to the netplan.io project), could you check for "netplan.io"?
[17:13] <mike40303> sorry, 0.99-0ubuntu3~18.04.3
[17:14] <slyon> ok. that should be alright
[17:16] <slyon> could you share your YAML config, e.g. via paste.ubuntu.com?
[17:23] <slyon> sorry... I need to run.
[17:29] <mike40303> thank you, here it is https://paste.ubuntu.com/p/TKM6ZYJkCH/
[19:37] <mike40303> dhclient was running and wiping out the netplan config.    we got it running by adding the /etc/dhcp/dhclient-exit-hooks.d/systemd-networkd script mentioned here in update #3
[19:37] <mike40303> https://serverfault.com/questions/1007936/stop-google-compute-instance-from-configuring-second-network-interfacehttps://serverfault.com/questions/1007936/stop-google-compute-instance-from-configuring-second-network-interface