I want to create a VPN connection to another network, but we have to map our Addresses (172.16.0.0/22) to a new IP because the destination network is also using our IPs. So we tried to setup this connection with the NETMAP target. We want to access services in 3 networks at the destination: 18.104.22.168/17, 22.214.171.124/16, 126.96.36.199/16 (only an example!) Also it's not possible to map our network 1:1, but we have only one ip address accepted by the destination network (192.168.72.1). I have the following nat rules configured:
Chain eth0_in (1 references) target prot opt source destination NETMAP all -- 188.8.131.52/16 192.168.72.1 172.16.0.0/22 NETMAP all -- 184.108.40.206/16 192.168.72.1 172.16.0.0/22 NETMAP all -- 220.127.116.11/16 192.168.72.1 172.16.0.0/22 Chain eth0_masq (1 references) target prot opt source destination MASQUERADE all -- 172.16.0.0/16 anywhere policy match dir out pol none SNAT all -- 172.16.0.0/16 anywhere policy match dir out pol none to:192.168.72.1 Chain eth0_out (1 references) target prot opt source destination NETMAP all -- 172.16.0.0/22 18.104.22.168/16 192.168.72.1/32 NETMAP all -- 172.16.0.0/22 22.214.171.124/16 192.168.72.1/32 NETMAP all -- 172.16.0.0/22 126.96.36.199/16 192.168.72.1/32
This works partly. The first address accessed after a iptables reload works, but all other addresses aren't working. e.g
telnet 188.8.131.52 works telnet 184.108.40.206 fails
-- reload all iptables
telnet 220.127.116.11 works telnet 18.104.22.168 fails
What is wrong? Is it possible to map a network to one IP for multiple destinations?