作者:张华 发表于:2015-09-30
版权声明:可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息及本版权声明
( http://blog.csdn.net/quqi99)
1, 服务端
sudo apt-get install openvpn
cd /etc/openvpn && sudo openvpn --genkey --secret secret.key
cat /etc/openvpn/myvpn_server.conf
dev tun
ifconfig 172.16.10.1 172.16.10.2
keepalive 10 60
proto udp
port 443 # remember to open this port in firewall
#user nobody
#group nogroup
persist-tun
persist-key
comp-lzo
verb 3
secret /etc/openvpn/secret.key
vi /etc/rc.local
echo "1" > /proc/sys/net/ipv4/ip_forward
iptables -t nat -A POSTROUTING -s 172.16.10.2/32 -o eth0 -j MASQUERADE
/usr/sbin/openvpn /etc/openvpn/myvpn_server.conf &
2, 客户端
sudo /usr/sbin/openvpn /etc/openvpn/myvpn_client.conf
dev tun
remote 162.213.34.162
ifconfig 172.16.10.2 172.16.10.1
keepalive 10 60
proto udp
port 443
persist-tun
persist-key
comp-lzo
verb 3
secret /etc/openvpn/secret.key
redirect-gateway def1