Linux

Ubuntu : Setting OpenVPN Pre-Shared Static Key

:: What is
Setting OpenVPN with static key are ideal for point-to-point VPNs or proof-of-concept testing.

:: Installing OpenVPN Server in Ubuntu

aptitude install openvpn

:: Create Pre-Shared Static Key for OpenVPN

openvpn --genkey --secret /etc/openvpn/shared.key

:: Setup OpenVPN to use Pre-Shared Static Key

vi /etc/openvpn/server.conf

Add configuration like these:

dev tun
ifconfig 10.3.0.1 10.3.0.2
secret /etc/openvpn/shared.key
verb 3
mute 10
daemon

:: Starting OpenVPN Server in Ubuntu

/etc/init.d/openvpn start

:: Enable ip forwarding

vi /etc/sysctl.conf

Enable this line:

net.ipv4.ip_forward=1

and apply sysctl for saved permanent

sysctl -p

:: Connection to OpenVPN Server from Ubuntu client
+ Installing OpenVPN Client

sudo aptitude install network-manager-openvpn-gnome

Add new OpenVPN connection using network-manager and add some like these:

  • VPN tab
  • Gateway: your-openvpn-server-ip
  • Static key: shared.key # static key file from server
  • Remote ip: 10.3.0.1
  • Local ip: 10.3.0.2
  • IPv4 Settings tab
  • – Routers..
  • + Enable Ignore automatically obtained routers
  • + Enable Use this connection only for resource on it’s network

:: Testing OpenVPN connection
From Server:

ping 10.3.0.2

From Local or Client:

ping 10.3.0.1

:: Links
+ Google
+ OpenVPN
+ Adeptus

Hi, I’m Sysadmin.ID

Leave a Reply

Your email address will not be published. Required fields are marked *