VPN for specific IP address

Business solution to host your own OpenVPN server with web management interface and bundled clients.
Post Reply
ashish169
OpenVpn Newbie
Posts: 2
Joined: Sat Apr 13, 2019 8:02 am

VPN for specific IP address

Post by ashish169 » Sat Apr 13, 2019 8:18 am

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.

User avatar
novaflash
OpenVPN Inc.
Posts: 1073
Joined: Fri Apr 13, 2012 8:43 pm

Re: VPN for specific IP address

Post by novaflash » Sat Apr 13, 2019 6:18 pm

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.
I'm still alive, just posting under the openvpn_inc alias now as part of a larger group.

ashish169
OpenVpn Newbie
Posts: 2
Joined: Sat Apr 13, 2019 8:02 am

Re: VPN for specific IP address

Post by ashish169 » Mon Apr 15, 2019 7:11 am

Hi,

Above solution worked perfectly, thanks a lot!

Post Reply