Tuesday, October 11, 2011

[ Manual | Linux | Network ] Setup openvpn utility to connect via VPN

This post describes how to setup openvpn utility to connect via VPN.

You need to:
  • install openvpn
  • prepare *.crt file with digital sign
  • prepare configuration file
  • setup gateway
So, let's start.

First, install openvpn utility to use it as vpn client:
sudo apt-get install openvpn

Next, put your *.crt file here:

If you have no valid .crt file - you should ask administrators of vpn server to share it.

Now, create configuration file for your connection.
sudo touch /etc/openvpn/my.conf

With such content:
dev tun
proto tcp
remote _put_here_ip_or_hostname_of_vpn_server_
resolv-retry infinite
ca my.crt
verb 3
mute 20

Also, you need to set your default gateway, if such error occured:
OpenVPN ROUTE: net_gateway undefined -- unable to get default gateway from system

To add and configure default gateway, execute it:
route add default gw eth0

Finaly, to open VPN connection, execute such command:
cd /etc/openvpn
sudo openvpn --config ./my.conf

That's it! You should only input your authorization information (login, password) and connection will be successfully opened.

No comments: