Login

Forgot password?

We love free and open web!

Author Topic: Setting up VPN for CentOS  (Read 75315 times)

Offline Administrator

  • Administrator
  • Jr. Member
  • *****
  • Posts: 88
    • View Profile
Setting up VPN for CentOS
« on: November 07, 2011, 12:27:17 AM »
Make sure that your server supports TUN/TAP. You can verify that by using the following command
Code: [Select]
[root@vpnforums ~]# cat /dev/net/tun
cat: /dev/net/tun: File descriptor in bad state
[root@vpnforums ~]#

It will output "File descriptor in bad state" if it is working.

If you got. Make sure that the module is installed. If you are using a OpenVZ VPS, you might need to ask your VPS provider to enable TUN/TAP on your VPS.
Code: [Select]
[root@vpnforums ~]# cat /dev/net/tun
cat: /dev/net/tun: No such device
[root@vpnforums ~]#


To make the installation easier, we made a script that you can use to install a VPN. Just run the following commands to start the installation.

Code: [Select]
wget http://www.vpnforums.com/downloads/install-openvpn.sh
chmod +x install-openvpn.sh
./install-openvpn.sh

You will be prompted to enter values for your server and client certificate, feel free to accept (hit enter) the default values. Its not recommended to setup a password for your server certificate as you will have to type in the password each time you wish to start/restart the openvpn daemon.
You can however set a password for your client’s certificate since it offers extra level of protection in case your certificate and key files are compromised. You will be prompted for that password each time you connect on your VPS’s VPN.

After the script finished installing openvpn (should be very quick) the client keys and the openvpn client configuration file will be archived in /root/keys.tgz
You may use a sftp/scp client such as winscp or filezilla to download the archive on your computer.

If you already haven’t installed openvpn for windows you may do so now.
You may use winrar or 7zip to extract the content of keys.tgz in C:\Program Files\OpenVPN\config\VPN (create a folder named VPN there)
After you have extracted the files from keys.tgz in the above folder, you may start openvpn-gui from the start menu, right click the tray icon, go to VPN and click connect. After the icon turns green all your traffic will be forwarded through your VPS, no extra configuration on your browser/IM client/email client is required.