OpenVPN : Used Cases

From kraba notes
Jump to: navigation, search

Info

Used cases of OpenVPN, sometimes stupid or not safe. Tested on ubuntu 16.04 with cancerd systemd.

Servers :

Name Public IP Private IP
server1 1.1.1.1 10.0.0.2
server2 2.2.2.2 10.0.0.3

P2P Connection with key exchange

  • On server1 :
vim /etc/openvpn/p2p.conf

proto       udp
mode        p2p
remote      2.2.2.2
rport       1194
local       1.1.1.1
lport       1194
dev-type    tun
tun-ipv6
resolv-retry infinite
dev         vpn0
comp-lzo
persist-key
persist-tun
cipher aes-256-cbc
ifconfig 10.0.0.2 10.0.0.3
secret /etc/openvpn/p2p.key

and generate key:

openvpn --genkey --secret /etc/openvpn/p2p.key
  • On server2 :
vim /etc/openvpn/p2p.conf

proto       udp
mode        p2p
remote      1.1.1.1
rport       1194
local       2.2.2.2
lport       1194
dev-type    tun
tun-ipv6
resolv-retry infinite
dev         vpn0
comp-lzo
persist-key
persist-tun
cipher aes-256-cbc
ifconfig 10.0.0.3 10.0.0.2
secret /etc/openvpn/p2p.key

and copy the key from server1 to server2.

  • On both server:
systemctl start openvpn@p2p

or (on right linux):

service openvpn start p2p