united states of america usa  linkedinfacebookgoogle

Reserve IP in OpenVPN

openvpn-logo-300x300The IPs in the VPN are assigned randomly. If you have your router configured using something like Tomato, you can setup the reservation by MAC address. For the linux-based install, follow these steps:

1) To begin, first identify the directory, where the files will be stored:

 

mkdir /etc/openvpn/reserved

2) Add the path to your /etc/openvpn/server.conf file:

client-config-dir /etc/openvpn/reserved

3) Each client has to have it's own IP reservation. It is done based on CN from when each client was generated. Check your .cer or .crt file for a similar Subject line. In our case, the CN is client-connection

Subject: C=US, ST=FL, L=Miami, O=IT, OU=IT, CN=client-connection/name=changeme/emailAddress=This email address is being protected from spambots. You need JavaScript enabled to view it.

4) Edit the file (vim /etc/openvpn/reserved/client-connection) and add your IP (in our case it is 172.16.0.15):

ifconfig-push 172.16.0.15 255.255.255.0
#you can also optionally push the gateway, if you want the traffic to go through VPN. Uncomment below and replace as needed
#push "route 172.16.0.0 255.255.255.0 172.16.0.1"

and you are done.

ALT  your Linux experts in Miami!

Tel: (786) 646-6461   |   Toll-Free: (877) 454-0758
18350 NW 2nd Ave, Ste 406E | Miami, FL33169