Tuesday, February 17, 2009

Configuration Point-to-Point OpenVPN link

I like OpenVPN because it's simple and it does what you need - VPN.

Let's assume that we have two un*x like servers with OpenVPN software and regular OS user openvpn in group openvpn. One server has IP address 192.168.4.10 and second 192.168.4.100.

In server 192.168.4.10 use following configuration file (openvpn.conf):
remote 192.168.4.100
ifconfig 10.0.0.1 10.0.0.2
dev tun0
port 5001
proto udp
secret /usr/local/etc/openvpn/secret.key
ping 10
comp-lzo
verb 5
mute 10
user openvpn
group openvpn

In server 192.168.4.100 use following configuration file (openvpn.conf):
remote 192.168.4.10
ifconfig 10.0.0.2 10.0.0.1
dev tun0
port 5001
proto udp
secret /usr/local/etc/openvpn/secret.key
ping 10
comp-lzo
verb 5
mute 10
user openvpn
group openvpn

In one of this two servers create secret.key by issuing following command:
openvpn --genkey --secret /usr/local/etc/openvpn/secret.key

Finaly:
Somehow (for example scp) copy secret key to second server into correct location and run openvpn daemons on both servers. On servers new network interface appears (tap) with IP addresses (10.0.0.1 and 10.0.0.2) and you can ping these 10.0.0.1-2 IP addresses over secure VPN link.

Here we go.

No comments: