本帖最後由 角色 於 2013-11-28 01:24 編輯
The following link gives very good examples of different OpenVPN configurations.
[3] provides us many important concepts in order to send packets to the remoter server's gateway.
IP Forwarding
From [2], there are two important things that we need to notice. First one is to enable IP forwarding using
sysctl -w net.ipv4.ip_forward=1, or
echo 1 > /proc/sys/net/ipv4/ip_forward
MASQUERADE
#eth0 - internet
#eth1 - network
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i eth1 -j ACCEPT
For PPTP VPN
iptables -t nat -A POSTROUTING -o ppp0 -j MASQUERADE
In [4], it provides examples for OpenVPN with MASQUERADE.
In [5], it gives examples of setting the firewall.
[1] http://blog.wains.be/2008/07/18/ ... ugh-the-vpn-tunnel/
[2] http://www.ducea.com/2006/08/01/ ... orwarding-in-linux/
[3] http://blog.wains.be/category/vpn/
[4] http://wiki.openwrt.org/doc/recipes/routedclient
[5] http://wiki.openwrt.org/doc/uci/firewall |