Page 1 of 1

VPN for specific IP address

Posted: Sat Apr 13, 2019 8:18 am
by ashish169
I may be asking something simple but I need to use OpenVPN AS to connect from my laptop to app server IP using Open VPN, I do not want all my traffic to be routed through the VPN (only for some specific IP address).

I have installed OpenVPN AS on a Digital Ocean VM and am using Openvpn connect client on my laptop. Below are the steps I am using to install OpvenVPN on an Ubuntu 16.04 OS:

apt-get install net-tools ntp
wget http://swupdate.openvpn.org/as/openvpn- ... amd_64.deb
dpkg -i openvpn-as-2.1.12-Ubuntu16.amd_64.deb

I am using default steps to start the server and I basically select options as they are provided to me(I do not use any settings file):

./usr/local/openvpn_as/bin/ovpn-init

I am able to either 'route all traffic through VPN' or 'route no traffic through VPN' by saying 'yes' or 'no' to the option 'Route all traffic through VPN' option in the above init script, but I need to route only specific IP address traffic through the VPN.

I searched through the internet and this forum but am unable to find some straightforward method to accomplish this, my knowledge about networking may be a little limited, I understand basic networking related TCP IP etc but I guess I do not understand route tables that well.

Any help for this will be greatly appreciated.

Re: VPN for specific IP address

Posted: Sat Apr 13, 2019 6:18 pm
by novaflash
Go to the admin UI.
Go to VPN Settings.
Disable rerouting all VPN client traffic.
Disable pushing DNS.
Enable allowing access to private subnets. Set it to NAT. Specify an IP in CIDR format like: 123.45.67.89/32

The /32 means one IP.

Save settings. Update running servers. Done.

Re: VPN for specific IP address

Posted: Mon Apr 15, 2019 7:11 am
by ashish169
Hi,

Above solution worked perfectly, thanks a lot!