2

I've got a WiFi (en0) and Ethernet (en8) connection on my machine. Each interface is on a separate network and en0 has priority over en8.

The gateway for en0 is 192.168.100.1 and for en8 it is 172.20.10.1

There are services I need to access that are only available on the en0 network, and the VPN is only available via en2 network.

I want to be able to force the macOS Sierra L2TP client to use en8. I have successfully added a static route to route the IP address that I want to connect to, to the gateway of en2 and have verified by running trace get <vpn address>

However the connection still fails and when I look at the logs in /var/ppp/ppp.log it looks like the L2TP client is still trying to go through the en0 gateway:

Wed Mar 22 13:53:10 2017 : l2tp_get_router_address 192.168.100.1 from dict 1

Routing Table below: routing table

  • Oops, I've added it in now. – nothingtosee Mar 23 '17 at 5:12
  • Please add the output of netstat -f inet -r – klanomath Mar 23 '17 at 5:44
  • @klanomath I've updated post with routing table. I'm on a new machine now and the interfaces are now en0 and en8 respectively. – nothingtosee Mar 26 '17 at 23:41
1

Having two default gateways in macOS will result in: the gateway of the interface with the higher priority will be the default one and the other one is disregarded.

To get the order enter in Terminal: networksetup -listnetworkserviceorder.

So remove the default gateway of interface en8 and either add a custom route to the VPN server:

sudo route add -host <VPN-server-ip-address> -interface en8

or

sudo route add -host <VPN-server-ip-address> -link <MAC-of-en8>

or to the network (here the example network: 10.0.0.0/16)

sudo route -n add -net 10.0.0.0/16  172.20.10.1

Depending on the network environment of the VPN-server a second inverted route pointing to your local 172.20.10.0/28 network has to be added there.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .