Using iptables to route OpenVPN traffic

To have your vpn traffic be able to reach the internet you just need to add the following iptable rules:

iptables -A FORWARD -i tun0 -j ACCEPT
iptables -A FORWARD -i tun0 -o eth0 -m state –state RELATED,ESTABLISHED -j ACCEPT
iptables -A FORWARD -i eth0 -o tun0 -m state –state RELATED,ESTABLISHED -j ACCEPT
iptables -t nat -A POSTROUTING -s -o eth0 -j MASQUERADE

This would take the tunnel adapter of tun0 and route the traffic through eth0 for the vpn subnet of

This entry was posted in Arch, CentOS, Fedora, Guides, Linux, Networking and tagged , . Bookmark the permalink.

Leave a Reply