0

Im trying to get two tun dev connected. If got everything, but the nat running. One tun is secure connection and the other tun for internet access.

If got everything, but the nat running. There is a table "vpn".

I have

ip rule add dev tun1 table vpn
ip rule add from ip_tun1/24 table vpn

but the ip route add default via ip_tun0/24 table vpn won't work.

The command ip route add nat 10.8.0.0/24 via 10.4.30.0/24 table vpn doesn't work either.

Any suggestions?

  • "doesn´t work." why not? (or... what is the message you get?) – Rinzwind Sep 16 '13 at 8:01
  • @Rinzwind "RTNETLINK answers: Invalid argument" – finster Sep 16 '13 at 8:13
  • The /24 is probably wrong. Change the netmask to 255.255.255.255 and try again. – Rinzwind Sep 16 '13 at 8:15
  • Thx @Rinzwind. But there was a way without changing the netmask. I already used it once. But its gone... I have "ip rule add dev tun1 table vpn" -> "ip rule add from ip_von_tun1/24 table vpn"...but the "ip route add default via ip_tun0/24 table vpn" won´t work. So i try to find the missing link – finster Sep 16 '13 at 8:26
0

If you have the routing done correctly, then the NAT can be added by iptables commands. For instance letting the network 10.0.3.0/24 out via NAT requires:

iptables -t nat -A POSTROUTING -s 10.0.3.0/24 -j MASQUERADE
iptables -A FORWARD -s 10.0.3.0/24 -j ACCEPT

Beware, ip route add nat ... is not supported anymore...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.