I have a personal VPN that I use as a default gateway for all Internet traffic when I'm on the road. This works great and I have no problem.
I also have a work VPN, which I need to connect to reach machines on their private network.
What I want to do is use these together. Unfortunately, redirect-gateway def1
on my personal VPN appears to redirect everything, including traffic that should go over the work interface.
For example:
utun3: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
inet 192.168.192.6 --> 192.168.192.5 netmask 0xffffffff
utun4: flags=8051<UP,POINTOPOINT,RUNNING,MULTICAST> mtu 1500
inet 1.2.3.4 --> 1.2.3.4 netmask 0xfffff800
above utun3
is the personal network interface that redirects everything and utun4
is the work network interface that i need to connect to certain machines.
I have tried setting routes to no avail. Work machines are on the 172.31.0.0/16
network and I've tried to set routes such as:
route 172.31.0.0 255.255.0.0 utun4 0
but the connection just hangs. How can I make this work?
I think the correct syntax for the route add
command would be:
route add -net 172.31.0.0 netmask 255.255.0.0 gw 1.2.3.1
I am guessing on the gateway (gw) number;
you would need to ask your office's IT support about this
if you can't figure it out by diagnostic tools.
(Or, if I understood the first part your question correctly,
then you can use the def1
hostname.)
The reason you can't route it to the interface name directly, is because the network you are routing is not local on that interface.
User contributions licensed under CC BY-SA 3.0