Score:0

What is the best way to seperate routing tables in Ubuntu?

cn flag

I'm building a lab environment with multiple routing devices and 2 Ubuntu machines as clients (22.04.2). The ubuntu machines need to act as 8 independent clients (from networking point of view) because the core network is separated by VRFs.

The ubuntu machines connect to a switch which separates the traffic with 802.1Q trunking so these clients will receive traffic on multiple different VLANs. My problem is that the clients need to have a default route for each vlan, which not possible in a single routing table.

How can I separate the IP traffic? I'm not very experienced in linux I read about VRFs and namespaces as options, but maybe you know other solutions. What would you recommend?

Update: This solution works pretty fine, but I'm still interested what are the alternatives.

root@ubuntu:/etc/netplan# more 00-installer-config.yaml 
# This is the network config written by 'subiquity'
network:
  vrfs:
    RED-vrf:
      table: 10
      interfaces: [ens4.10]

    BLUE-vrf:
      table: 20
      interfaces: [ens4.20]
  

  ethernets:
    ens4: {}


  vlans:
    ens4.10:
      id: 10
      link: ens4
      addresses: [10.0.0.2/30]
      routes:
        - to: 0.0.0.0/0
          via: 10.0.0.1

    ens4.20:
      id: 20
      link: ens4
      addresses: [20.0.0.2/30]
      routes:
        - to: 0.0.0.0/0
          via: 20.0.0.1
  version: 2
raj avatar
cn flag
raj
Is it an option to implement these clients as 8 separate virtual machines?
Seathorn avatar
cn flag
Honestly, I would like to avoid that.
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.