MacWho

route to openvpn

Nov 4th, 2014
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.06 KB | None | 0 0
  1. pyed | I set up my server, and now I'm connected, but I couldn't get the routing part right
  2. catphish | i'm not overly familiar with the "route" command, but something like this for a tun interface: route add -host 78.24.191.177 dev tun0
  3. pyed | catphish, after adding this route, I can't open the routed address anymore
  4. pyed | can't even ping the routed address
  5. catphish | pyed: that's not very surprising
  6. catphish | pyed: there are loads of reasons why pakets wouldnt come back to you
  7. catphish | the solution is more complicated and depends on whether you have public IPs or NAT, and whether you have set up correct reserve routes and NAT rules at the openvpn serverable
  8. catphish | assuming your openvpn uses a private IP range, you're sending a ping with a private source address
  9. catphish | the openvpn server can respond to that private address, so that's ok
  10. catphish | but to send that ping out to th internet, it will likely need to NAT it
  11. pyed | hmm
  12. catphish | which it may not be configured to do for vpn traffic
  13. pyed | I'll take another look at my server config
  14. catphish | openvpn doesn't imply any kind of network setup
  15. pyed | catphish, could you take a look at this: https://wiki.archlinux.org/index.php/OpenVPN#Routing_traffic_through_the_server
  16. catphish | is the server running on openwrt?
  17. pyed | no, it's running on arch
  18. pyed | archlinux
  19. catphish | this is the important part:
  20. catphish | iptables -t nat -A POSTROUTING -s 10.8.0.0/24 -o enp1s0 -j MASQUERADE
  21. catphish | you need a rule that NATs from your VPN range to your WAN interface
  22. catphish | if you've done that, it should work
  23. catphish | also, you need to ensure ip forwarding is enabled
  24. pyed | it's working !!
  25. pyed | thank you so much
  26. catphish | cool :)
  27. catphish | what was the problem?
  28. pyed | all I had to do is 'echo 1 > /proc/sys/net/ipv4/ip_forward'
  29. pyed | and do the iptables command, but I changed the 'enp1s0' to 'eth0' because that's my interface name
  30. pyed | now I just 'route add -host IP_ADDRESS dev tun0' on openwrt, and it's working as expected
Advertisement
Add Comment
Please, Sign In to add comment