Hello I have some questions on how to use iptables to forward IPsec VPN data. Here is what I want to do:
WAN Computer -- (eth1/WAN IP)Server1(eth0/10.81.1.2) -- (eth0/10.66.2.3)Server2(eth1/WAN IP) -- WAN
NOTE: The internal network of Server1 and Server2 can be connected
I have tried to set up these on Server1:
iptables -t nat -A PREROUTING -p udp --dport 4500 -j DNAT --to-destination 10.66.2.3
iptables -t nat -A PREROUTING -p udp --dport 500 -j DNAT --to-destination 10.66.2.3
iptables -t nat -A PREROUTING -p udp --dport 1701 -j DNAT --to-destination 10.66.2.3
iptables -t nat -A POSTROUTING -p udp -d 10.66.2.3 --dport 4500 -j SNAT --to-source 10.81.1.2
iptables -t nat -A POSTROUTING -p udp -d 10.66.2.3 --dport 500 -j SNAT --to-source 10.81.1.2
iptables -t nat -A POSTROUTING -p udp -d 10.66.2.3 --dport 1701 -j SNAT --to-source 10.81.1.2
iptables -A FORWARD -p esp -j ACCEPT
iptables -A FORWARD -p ah -j ACCEPT
But now I cannot connect to Server2 on the WAN computer using the Server1's WAN IP (IPsec VPN can be used to connect to Server2 directly on the WAN computer over the WAN).
I may be mistaken for some part, how can I set up to use Server1 to connect to Server2 to access the WAN?