I'm unable to send response packets via the "right" interface when switching from ip route
to netplan
.
The setup:
server - two interfaces
eth1
, vlan 101, 10.0.1.2/24, default route, 10.0.1.1 gate
eth2
, vlan 102, 10.0.2.2/24
client
eth0
vlan 102, 10.0.2.3/24, default route, 10.0.2.1 gate
There is a router (pfsense) in the middle that allows traffic between vlans.
Repro steps
When connecting from the client to the server using 10.0.2.2
everything works as expected.
When connecting from the client to the server using 10.0.1.2
The connection stays open for 30s and then communication stops. I believe that return packets from the server are sent using eth2
interface as this route is a "better" match.
I found this suse article https://www.suse.com/support/kb/doc/?id=000016626 that works for my case as long as I do this the ip route
way.
eg:
ip route add 10.0.1.0/16 dev eth1 src 10.0.1.2 table T101
ip route add default via 10.0.1.1 dev eth1 src 10.0.1.2 table T101
ip rule add from 10.0.1.2 table T101 prio 1
ip route add 10.0.2.0/16 dev eth2 src 10.0.2.2 table T102
ip route add default via 10.0.2.1 dev eth2 src 10.0.2.2 table T102
ip rule add from 10.0.2.2 table T102 prio 1
Problem
But I can't get similar result using netplan.
my netplan attempt:
network:
ethernets:
eth0:
dhcp4: false
optional: true
vlans:
vlan101:
id: 101
link: eth0
addresses: [10.0.1.2/24]
routing-policy:
- from: 10.0.1.2
table: 101
priority: 1
routes:
- to: default
via: 10.0.1.1
scope: link
from: 10.0.1.2
table: 101
- to: default
via: 10.0.1.1
vlan102:
id: 102
link: eth0
addresses: [10.0.2.2/24]
macaddress: dc:a6:32:c7:09:15
routing-policy:
- from: 10.0.2.2
table: 102
priority: 1
routes:
- to: default
via: 10.0.2.1
scope: link
from: 10.0.2.2
table: 102
version: 2
https://netplan.io
andhttps://netplan.io/examples
.