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