There are many articles if you Google for “OpenVPN setup”. Most of them teach you how to install OpenVPN on various operating systems and how to write server configuration files. But while some people are looking for solutions of getting into a LAN (in an office, for example) from outside, I think many are seeking a way of breaking through some network restrictions, or creating a secure tunnel to reach the Internet.
In the latter scenario, just getting OpenVPN daemon up running isn’t enough. What we need to do next is setting up IP traffic forwarding and set iptables rules to accept the traffic. Actually my favourate tutorial is this one:
Because the author included the firewall rules that’s needed to route traffic through the VPN server. Google didn’t get this post on their first page when we search, but this tutorial really works. One reason may be that the author has changed the site structure recently. I found the old link in my delicious account and it returned 404 when I visited it. But I finally got its new location by going to the front page and doing a site search.
Recently I tried to set up a VPN server on a VPS with Fedora 14 installed. I thought Fedora very much resembled CentOS so I followed the same steps. (Unlike CentOS, Fedora has relatively up-to-date packages in its default repository so just start with “yum install openvpn”.) But it didn’t work. At last I found that my Fedora install had some preset iptables rules that rejected the forwarding traffic. Open /etc/sysconfig/iptables and comment out the following two lines:
-A INPUT -j REJECT --reject-with icmp-host-prohibited -A FORWARD -j REJECT --reject-with icmp-host-prohibited
Then restart iptalbes and everything should be OK.