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.
Routing of non VPN traffic - a solution
-
- Posts: 202
- Joined: Wed Jul 10, 2013 2:07 pm
Re: Routing of non VPN traffic - a solution
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)
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)
-
- Posts: 5
- Joined: Sun Dec 20, 2015 1:52 pm
Re: Routing of non VPN traffic - a solution
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.
I agree, the solution I have come up with is a tad cumbersome, but it does work.
-
- Posts: 5
- Joined: Sun Dec 20, 2015 1:52 pm
Re: Routing of non VPN traffic - a solution
Got it. I added a route to the DHCP server, and removed the gateway, and it works perfectly.
Thanks for your advice and feedback.
Thanks for your advice and feedback.