One PC Two IPs: Use one for VPN client route

How to customize and extend your OpenVPN installation.

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

Post Reply
Gerryb
OpenVpn Newbie
Posts: 2
Joined: Wed Jun 15, 2016 7:04 am

One PC Two IPs: Use one for VPN client route

Post by Gerryb » Wed Jun 15, 2016 7:28 am

One VPS ubuntu two IPs. Client connection openvpn to a VPN service elsewhere. Connects OK.

I want to use second IP for VPN connection, leaving first IP and its routing alone. So

1.2.3.4 has default route to internet and must stay. Used for ordinary VPS roles such as email and web pages
5.6.7.8 has new default route via VPN for all exits used for things like TOR.

Services bound/listening to 5.6.7.8 send data via VPN (eg TOR)

I assume at the very least I will have to configure iproute2. Already added to the .ovpn file to route-noexec or the VPN server would push a whole system default route cutting me off from the server. I needed to get control of the routing. Currently the VPN server gives a dynamic IP with each connection to add to the complications of such a setup. It connects but no routes as yet.

Has anyone done this? Attach open VPN client connection to one of two IP and only route traffic of second IP via the VPN? Is there a HOWTO? !

Gerry

seanvree
OpenVpn Newbie
Posts: 12
Joined: Thu Jul 21, 2016 10:40 pm

Re: One PC Two IPs: Use one for VPN client route

Post by seanvree » Wed Jul 27, 2016 4:16 am

I've been trying to do this on my Windows Box and have been pulling my hair out.

I was told the best way to do this is to bridge the 2nd NIC with the TAP adapter. I've been trying to configure it, but I can't get it to work.

viewtopic.php?f=15&t=22144

Gerryb
OpenVpn Newbie
Posts: 2
Joined: Wed Jun 15, 2016 7:04 am

Re: One PC Two IPs: Use one for VPN client route

Post by Gerryb » Wed Jul 27, 2016 5:13 am

I am trying on Ubuntu

On Windows is seemed easier, but do not have a machine to remember how! In Remote and Routing, under NAT set rules for each IP.
Then set open VPN to use the second IP. I moved to Softethervpn for many uses as it could get out through any firewall and the server is compatible with openvpn, and easier to configure.

seanvree
OpenVpn Newbie
Posts: 12
Joined: Thu Jul 21, 2016 10:40 pm

Re: One PC Two IPs: Use one for VPN client route

Post by seanvree » Wed Jul 27, 2016 11:09 pm

Gerryb wrote:I am trying on Ubuntu

On Windows is seemed easier, but do not have a machine to remember how! In Remote and Routing, under NAT set rules for each IP.
Then set open VPN to use the second IP. I moved to Softethervpn for many uses as it could get out through any firewall and the server is compatible with openvpn, and easier to configure.
Are you talking on the client machine, or in the router?

TiTex
OpenVPN Super User
Posts: 310
Joined: Tue Apr 12, 2011 6:22 am

Re: One PC Two IPs: Use one for VPN client route

Post by TiTex » Fri Aug 12, 2016 2:46 pm

something similar has been discussed here viewtopic.php?f=15&t=19200
basically you need to setup policy routing

Post Reply