Two gataway in same network and return packet nat
Posted: Thu Mar 11, 2021 4:08 pm
Hi, I got the setup.
192.168.150.1/24 <- main router
192.168.150.251/24 <- secondary router (secondary gateway)
all devices in 150.0/24 got 150.1 as a gateway, at this gateway is a mangle rule to route some traffic specific traffic (for example all traffic from 192.168.150.60) out through secondary gateway in out L2TP VPN).
ping and ICMP work fine but TCP and udp not. I think the problem is in nat:
If packet for example goes from 192.168.150.60 to 1.1.1.1 it goes like this(s: src address, d: destination address)
(PC) s:150.60 d: 1.1.1.1 -> (MAIN ROUTER) s:150.60 d: 1.1.1.1 -> (SECONDARY ROUTER) s:150.60 d: 1.1.1.1 ->(VPN) s:150.251 d:1.1.1.1 <- so far so good
but if packet is coming back it goes like this:
(VPN) s:1.1.1.1 d:150.251 -> (SECONDARY ROUTER) s:1.1.1.1 d:150.60 -> it is the same subnet so the secondary router sends it straight to PC (PC)s:1.1.1.1 d:150.60 <- wrong because the PC drops that packet as invalid because it does not wait for response from the secondary router but from the main router.
But how solve this problem? I try set src-nat at main router but without success. For some reason, if packet goes through srcnat at a main router at the moment when it came to secondary router the src address is still 192.168.150.60 (PC)
Any advice? thanks
192.168.150.1/24 <- main router
192.168.150.251/24 <- secondary router (secondary gateway)
all devices in 150.0/24 got 150.1 as a gateway, at this gateway is a mangle rule to route some traffic specific traffic (for example all traffic from 192.168.150.60) out through secondary gateway in out L2TP VPN).
ping and ICMP work fine but TCP and udp not. I think the problem is in nat:
If packet for example goes from 192.168.150.60 to 1.1.1.1 it goes like this(s: src address, d: destination address)
(PC) s:150.60 d: 1.1.1.1 -> (MAIN ROUTER) s:150.60 d: 1.1.1.1 -> (SECONDARY ROUTER) s:150.60 d: 1.1.1.1 ->(VPN) s:150.251 d:1.1.1.1 <- so far so good
but if packet is coming back it goes like this:
(VPN) s:1.1.1.1 d:150.251 -> (SECONDARY ROUTER) s:1.1.1.1 d:150.60 -> it is the same subnet so the secondary router sends it straight to PC (PC)s:1.1.1.1 d:150.60 <- wrong because the PC drops that packet as invalid because it does not wait for response from the secondary router but from the main router.
But how solve this problem? I try set src-nat at main router but without success. For some reason, if packet goes through srcnat at a main router at the moment when it came to secondary router the src address is still 192.168.150.60 (PC)
Any advice? thanks