VPN server inside a CT? [message #38730] |
Fri, 22 January 2010 11:14 |
althalus
Messages: 12 Registered: April 2009
|
Junior Member |
|
|
Hi,
I'm trying to set up a VPN server inside a container using vtund. Following http://wiki.openvz.org/VPN_via_the_TUN/TAP_device I managed to get the tun device working, and I also managed to get a basic vtund setup working, with the CT as the server, and a machine in a different network connecting. The problem is, the IP addresses used for the tunnel are a different network, and I can't work out how to allow communication between the client and the rest of the network the server exists in.
Any pointers or suggestions? Is there a better/easier way than using vtund?
|
|
|
Re: VPN server inside a CT? [message #38732 is a reply to message #38730] |
Fri, 22 January 2010 14:35 |
ceegeebee
Messages: 4 Registered: October 2009
|
Junior Member |
|
|
tcpdump is your friend.
If your VPN tunnel is up, and you can ping the tunnel interface's remote IP address, then the rest should just be routing.
Your remote server is most likely generating packets with a source IP of the tunnel interface. That will be received by your VZ containers VPN software on the tun interface, and then put out on the venet network with the same source IP. You should see with with 'tcpdump -ni venet0 icmp' on the VPN container, and then send a ping from the remote site, to a node on the container nodes network.
If this looks good so far, the issue might be that your receiving node on the VPN server side, doesn't have a route for this VPN tunnel range. It will hand it off to it's default gateway, and if that gateway doesn't have a route for your VPN range, the packets go in the wrong direction. tcpdump or wireshark on the ICMP receiving node will allow you to confirm the packet is being received.
NAT on the VZ VPN node can help to rewrite the source IP of the remote server, to be that of the LAN IP of the VPN server. That allows you to ensure packtes come back to the VPN server, without getting the routing fixed up. On the VPN server,
iptables -t nat -A POSTROUTING -o venet0 -s vpn.ip.of.remote.server -j SNAT --to-source lan.ip.of.vz.vpn.server
Let me know how that goes.
Chris Bennett
cgb
[Updated on: Fri, 22 January 2010 14:36] Report message to a moderator
|
|
|
|
|
|
|
|
Re: VPN server inside a CT? [message #38747 is a reply to message #38746] |
Sun, 24 January 2010 08:24 |
ceegeebee
Messages: 4 Registered: October 2009
|
Junior Member |
|
|
I'm glad to hear your problem is fixed - I was running out of ideas as it all seemed to be configured right except you're tests were failing ..
I havn't used vtun before, but OpenVPN is a really flexible VPN solution for LAN to LANs and hub/spoke client VPN access. If you continue to experience problems, and suspect it's vtun related, give OpenVPN a go.
|
|
|