Routing of non VPN traffic - a solution

Post your questions about SoftEther VPN software here. Please answer questions if you can afford.
Post Reply
aardvark
Posts: 5
Joined: Sun Dec 20, 2015 1:52 pm

Routing of non VPN traffic - a solution

Post by aardvark » Sun Dec 20, 2015 2:07 pm

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.

qupfer
Posts: 202
Joined: Wed Jul 10, 2013 2:07 pm

Re: Routing of non VPN traffic - a solution

Post by qupfer » Sun Dec 20, 2015 10:56 pm

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)

aardvark
Posts: 5
Joined: Sun Dec 20, 2015 1:52 pm

Re: Routing of non VPN traffic - a solution

Post by aardvark » Sun Dec 20, 2015 11:57 pm

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.

aardvark
Posts: 5
Joined: Sun Dec 20, 2015 1:52 pm

Re: Routing of non VPN traffic - a solution

Post by aardvark » Mon Dec 21, 2015 4:57 pm

Got it. I added a route to the DHCP server, and removed the gateway, and it works perfectly.

Thanks for your advice and feedback.

Post Reply