Score:0

Ubuntu 20.04 netplan second interface to access a host directly

vg flag

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.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.