We have servers in a colocation DC and have two uplinks: A fast metered connection (for live traffic) and a slow flat rate one (for things like backups). We'd like to use a Linux box for routing and have a specific uplink be used depending on the local source subnet, effectively meaning two different default routes. This should be possible with separate routing tables, but I haven't quite been able to grok them.
The following is a faulty example netplan config, omitting things like VLANs, nameservers etc:
network:
version: 2
ethernets:
eth0:
addresses: [ 5.5.5.2/27 ]
routes:
- to: default
via: 5.5.5.1 # provider edge fast uplink
eth1:
addresses: [ 6.6.6.2/27 ]
routes:
- to: default
via: 6.6.6.1 # provider edge cheap uplink
eth2:
addresses: [ 10.20.30.1/24 ]
eth3:
addresses: [ 10.20.40.1/24 ]
Outbound traffic from subnet 10.20.30.0/24 should use the fast uplink, traffic from 10.20.40.0/24 the cheap one. Also the local subnets must be able to reach each other. How should the config look to achieve that? NATing for outgoing traffic will be done via iptables.