i've an ubuntu 20.04 server with netplan (netplan.io/focal-updates,now 0.104-0ubuntu2~20.04.2 amd64). There are two network interfaces ens18 and ens19. ens18 is the main interface, all traffic should be routed through this interface. ens19 should only be used to access the ip 10.10.3.36 directly without a gateway. All other clients in 10.10.3.0/24 should be accessed by ens18.
# This is the network config written by 'subiquity'
network:
version: 2
ethernets:
ens18:
addresses: [10.10.0.10/24]
gateway4: 10.10.0.1
nameservers:
search: [example.net]
addresses: [10.10.0.1]
ens19:
addresses: [10.10.3.253/24]
nameservers:
search: [example.net]
addresses: [10.10.3.1]
routes:
- to: 10.10.3.36
scope: link
This adds some routes:
default via 10.10.0.1 dev ens18 proto static
10.10.0.0/24 dev ens18 proto kernel scope link src 10.10.0.10
10.10.3.0/24 dev ens19 proto kernel scope link src 10.10.3.253
10.10.3.36 dev ens19 proto static scope link
Now 10.10.3.0/24 will be accessed by ens19 and not only 10.10.3.36.
When deleting the ens19 default route, all works as aspected:
sudo ip route del 10.10.3.0/24 dev ens19 proto kernel scope link src 10.10.3.253
But this is not persistent at reboot.
What is the equivalent config in netplan?
Thank you very much!
Why?: Roborock S7 does not respond when client is in another subnet and my router does not support masquerade. So i need a second interface to access the roborock within the same subnet. All other traffic should go through the main interface.