1) Enable IP forwarding (server machine)
# echo 1 > /proc/sys/net/ipv4/ip_forward
To make the change permanent insert or edit the following line in edit /etc/sysctl.conf:
net.ipv4.ip_forward = 1
2) Iptables initial settings (server machine)
# iptables -F
# iptables -t nat -F
# iptables -t mangle -F
# iptables -X
3) Forward/Masquerade (server machine)
# iptables -A POSTROUTING -s 192.168.1.0/24 -o tun+ -j MASQUERADE -t nat
# iptables -I FORWARD -s 192.168.1.0/24 -j ACCEPT
# iptables -I FORWARD -d 192.168.1.0/24 -j ACCEPT
4) In the client machine, add the new default gateway
# ip route del default
# ip route add default via 192.168.1.66
No comments:
Post a Comment