June 24, 2010

 

VPN tunnel configuration

Using OpenVPN, OpenVPN GUI at client and also iptables on server-side for NAT.
client openvpn config (replace $SERVER_IP with actual real ip):
remote $SERVER_IP
dev tun
ifconfig 10.8.0.2 10.8.0.1
secret static.key
redirect-gateway


server NAT:
clear rules:
iptables -F; iptables -t nat -F; iptables -t mangle -F

NAT enable (replace param $SERVER_.... with external ip):
iptables -t nat -s 10.8.0.2 -A POSTROUTING -j SNAT --to $SERVER_EXTERNAL_URL


server openvpn config:
dev tun
ifconfig 10.8.0.1 10.8.0.2
route 10.8.0.0 255.255.255.0
secret static.key
push "redirect-gateway"
push "dhcp-option DNS 10.8.0.1"


also possible to compress traffic, but i did not yet tried it.

Labels: , ,

Comments: Post a Comment



<< Home

This page is powered by Blogger. Isn't yours?