Reply To: [RESOLVED] NAT through VPN do not work

Home Page Forums Network Management Networking [RESOLVED] NAT through VPN do not work Reply To: [RESOLVED] NAT through VPN do not work

#53965

redfive
Participant

Now yes !
try as follows … firstly, remove all virtual server rules, as well as the static routes regarding the remote networks, then add, Scripts/Cron, NAT and Virtual Servers script, these lines
on siteA

iptables -t nat -I POSTROUTING -o VPN00 -s 192.168.0.0/24 -d 192.168.2.0/24 -j NETMAP --to 192.168.1.0/24
iptables -t nat -I PREROUTING -i VPN00 -s 192.168.1.0/24 -d 192.168.2.0/24 -j NETMAP --to 192.168.0.0/24

on siteB

iptables -t nat -I POSTROUTING -o VPN00 -s 192.168.0.0/24 -d 192.168.1.0/24 -j NETMAP --to 192.168.2.0/24
iptables -t nat -I PREROUTING -i VPN00 -s 192.168.2.0/24 -d 192.168.1.0/24 -j NETMAP --to 192.168.0.0/24

Enable the script, save, look if the rules are applied (in case, reboot)

iptables -t nat -nvL

Then static routes, on siteA

192.168.2.0 255.255.255.0 via 1.1.1.2

on siteB

192.168.1.0 255.255.255.0 via 1.1.1.1

The commands above will translate the whole network portion of the ip address, leaving intact the host portion, so, for eg. for reaching a server located in siteB at 192.168.0.10, from siteA you will type 192.168.2.10…..
It should* work …. (or, at least I believe … :lol:)
Regards