I'm trying to set up a Ubuntu-based gateway between clients and the core router, the ideal traffic flow should be:
ClientGroup 1 (10.0.0.0/24) -> Ubuntu gateway (10.0.0.2) -> Core router (10.0.0.1) -> Internet
ClientGroup 2 (10.0.1.0/24) -> Ubuntu gateway (10.0.1.2) -> Core router (10.0.1.1) -> Internet
ClientGroup 3 (10.0.2.0/24) -> Ubuntu gateway (10.0.2.2) -> Core router (10.0.2.1) -> Internet
Clients use Ubuntu instance as their gateway.
The following netplan
configuration routes internal traffic properly, however for Internet traffic, it defaults to eth0.1
(10.0.1.1) because of gateway4
.
network: version: 2 ethernets: eth0: addresses: [10.0.0.2/24] routes: - to: 10.0.0.0/24 via: 10.0.0.1 table: 101 routing-policy: - from: 10.0.0.0/24 table: 101 dhcp4: false vlans: eth0.1: id: 1 link: eth0 addresses: [10.0.1.2/24] gateway4: 10.0.1.1 routes: - to: 10.0.1.0/24 via: 10.0.1.1 table: 102 routing-policy: - from: 10.0.1.0/24 table: 102 dhcp4: false eth0.2: id: 2 link: eth0 addresses: [10.0.2.2/24] routes: - to: 10.0.2.0/24 via: 10.0.2.1 table: 103 routing-policy: - from: 10.0.2.0/24 table: 103 dhcp4: false
Any ideas on how to route all traffic to its corresponding next-hop on the core router? Namely, all traffic (0.0.0.0/0
) from 10.0.0.0/24
should be routed to 10.0.0.1
whereas 10.0.2.0/24
should be routed to 10.0.2.1
.
I'm happy to use plain ip route
rules as well.
Thanks in advance!
Edit 13/05/20:
I have added a default route to each routes
, the routing is working as expected but traceroute
output seems weird:
routes: - to: 0.0.0.0/0 via: 10.0.0.1 table: 101
1st test:
traceroute to 1.1.1.1 (1.1.1.1), 64 hops max, 52 byte packets 1 10.0.0.2 (10.0.0.2) 0.896 ms * * 2 10.0.0.1 (10.0.0.1) 1.361 ms 1.126 ms 0.879 ms
2nd test:
traceroute to 1.1.1.1 (1.1.1.1), 64 hops max, 52 byte packets 1 * * * 2 10.0.0.1 (10.0.0.1) 1.353 ms 1.062 ms 0.825 ms