Add Multiple VPN External IPs?

How to customize and extend your OpenVPN installation.

Moderators: TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech, TinCanTech

Post Reply
kaveenkk9
OpenVpn Newbie
Posts: 1
Joined: Sun Mar 20, 2016 3:09 am

Add Multiple VPN External IPs?

Post by kaveenkk9 » Sun Mar 20, 2016 3:19 am

server.conf

Code: Select all

port 1194
proto udp
dev tun
ca ca.crt
cert server.crt
key server.key  # This file should be kept secret
dh dh2048.pem
server 10.8.0.0 255.255.255.0
ifconfig-pool-persist ipp.txt
push "redirect-gateway def1"
push "dhcp-option DNS 208.67.222.222"
push "dhcp-option DNS 208.67.220.220"
keepalive 10 120
comp-lzo
user nobody
group nogroup
persist-key
persist-tun
status openvpn-status.log
verb 3
So right now, I have a VPS, running OpenVZ Virtualization. This VPS has 10 IPs,

Code: Select all

205.185.115.235 209.141.56.183 209.141.41.65 209.141.53.249 209.141.48.160 209.141.49.106 198.251.80.134 198.251.80.136 209.141.38.87 198.251.80.131 209.141.38.94
I want it so that when a client connects, it shuffles through these ips, and looks for an ip that is NOT IN USE BY ANY OTHER CLIENT, then assigns it, then it is usable by the client that connects.

Just to clarify, I want it so that NO TWO CLIENTS have the same external ip.
Could anyone explain how this would be possible and tell me how to do it, what edits I need to make, what iptables rules I need to add? The interfaces I have are venet0 to venet0:10

User avatar
Traffic
OpenVPN Protagonist
Posts: 4066
Joined: Sat Aug 09, 2014 11:24 am

Re: Add Multiple VPN External IPs?

Post by Traffic » Sun Mar 20, 2016 8:09 pm

You can do this by firing a --client-connect script to configure your iptables

OpenVPN cannot manage this requirement per se ..

Post Reply