· 7 years ago · Sep 18, 2018, 06:38 AM
1echo 1 > /proc/sys/net/ipv4/ip_forward
2
3ip route add 10.0.0.10/32 via 10.0.0.1 dev NET-A
4iptables -t nat -A POSTROUTING -o NET-A -j MASQUERADE
5
6I think this is a mistake due to a routing conflict here.
7This assumes that the same subnet 10.0.0.2 and 10.0.0.1 lives in two separate locations.
8This would be a fatal flaw in network topology.
9If we wanted to work around this, this would be
10ip route add 10.0.0.2/32 via 192.168.0.1 dev NET-B
11iptables -t nat -A POSTROUTING -o NET-B -j MASQUERADE
12
13ip route add 192.168.0.2/32 via 192.168.1.12 dev NET-C
14 ip route add 192.168.1.1/32 via 192.168.1.12 dev NET-C
15 iptables -t nat -A POSTROUTING -o NET-C -j MASQUERADE
16
17iptables -A PREROUTING -t nat -i NET-A -p tcp --dport 10022 -j DNAT --to 192.168.1.2:22