Force native MacOS L2TP client to use specific interface
Hello all!
Let me jump into the mess.
The problem:
I do have a fully working L2TP VPN server. Once my Mac is residing on the same subnet as the VPN server, I can establish a successful connection without any issues.
The problem comes, when I want to do a nested tunneling. Once I am connected on an external/public network, I can see/ping/nmap successfully on 1701, 4500 and 500 ports my l2tp server without a problem, but only if I have my other VPN established first. Let me be more specific here: my l2tp server is accessible only through another VPN connection (nested tunneling). My l2tp server is fully enabled to handle such connections, because this solution works fine on windows and linux distros, but not on MacOS.
The reason:
During my troubleshooting process, I found what is causing the problem.
This issue comes from how native l2tp client handles the l2tp vpn server search. I started listening the traffic on my external/public interface, and I've done the same on the interface that my initial/first VPN connection has created. I turns out, that when I click "connect" on the l2tp client, the traffic goes out ONLY through my external/public interface. This means, the client is trying to search for my l2tp server in internet. So, I guessed that the traffic by default, goes out through your default gateway. Makes sense. Then, I've decided to put static routes and tell my Mac that this VPN server IP address, should be routed through my first VPN interface connection. And boom! For some reason, regardless how many and different static routes I have, the native l2tp vpn client ALWAYS routes out my traffic through my external interface, hence cannot find my server out in the public
That's a bit strange. I've never seen a product not taking the static routes in to consideration??? I guess there are some badly hardcoded stuff on that client...
The question:
I am starting to feel desperate in trying to force the native client to route its traffic through specific interface... I will be glad if someone can suggest some workaround, please?
MacBook