0

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.

2 Answers 2

1

Answering my own question. The configuration that solves the requirements looks like this:

network: version: 2 renderer: networkd 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 metric: 102 table: 200 eth2: addresses: [ 10.20.30.1/24 ] routes: - to: 10.20.30.0/24 table: 200 eth3: addresses: [ 10.20.40.1/24 ] routes: - to: 10.20.40.0/24 routing-policy: - from: 10.20.40.0/24 table: 200 

Notes:

  • The solution uses two routing tables, the default table (which simplifies networking on the router itself) and table 200.
  • As the two private subnets need to be able to reach each other despite using different routing tables, each private interface/subnet needs to add itself to the other routing table.
0

Routing for multiple uplinks/provider: https://lartc.org/howto/lartc.rpdb.multiple-links.html

2
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Commented Jun 22, 2023 at 12:19
  • The link does not answer the question because a netplan-specific solution is required. Commented Sep 17, 2023 at 9:15

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.