Page 1 of 1

Routing of non VPN traffic - a solution

Posted: Sun Dec 20, 2015 2:07 pm
by aardvark
I have the client set up in Windows, connecting via TCP to a server in another location. Server DHCP set up with defaults, 192.168.30.0/24 subnet, routing to local network of 192.168.254.0/24

I only want traffic for 192.168.254.0/24 subnet to go through VPN.

I found creating a batch file with these routes solved the problem. Batch file has to be run with admin privileges:

@echo on
route add 192.168.254.0 mask 255.255.255.0 192.168.30.1
pause
route add 0.0.0.0 mask 0.0.0.0 192.168.1.254 metric 1 if 4
pause

The pause enables me to check if the route add command has worked.

In addition, I set the metric for the network adapter to 1, and the virtual adapter as 100 , but I'm not sure if that had any effect.

The batch file needs to be run after you connect.

Re: Routing of non VPN traffic - a solution

Posted: Sun Dec 20, 2015 10:56 pm
by qupfer
This may be a "solution" but a more elegant one is a proper configuration of the used dhcp server.

It should serve a
- empty "DHCP Option 3" (--> no default Gateway --> nothing goes over vpn by default)
- correct route via "DHCP Option 121" (--> only this routed traffic goes through vpn)

Re: Routing of non VPN traffic - a solution

Posted: Sun Dec 20, 2015 11:57 pm
by aardvark
I tried the empty default gateway, but I couldn't get to some of the devices on the network. Must have missed something.

I agree, the solution I have come up with is a tad cumbersome, but it does work.

Re: Routing of non VPN traffic - a solution

Posted: Mon Dec 21, 2015 4:57 pm
by aardvark
Got it. I added a route to the DHCP server, and removed the gateway, and it works perfectly.

Thanks for your advice and feedback.