Ubuntu: How to avoid all internet traffic going through VPN connection when established


I am trying to resolve the following problem: I need to be connected to my company's Mikrotik router to reach company's NAS server. It works well. But if I stay connected all the time then all my internet traffic goes through VPN connection and consequentially it is painfully slow. So how can I force my internet traffic to avoid VPN connection? I believe that it can be solved through VPN settings in Network Manager (GUI) but ticking off "only use for local resources" at Routes in IPv4 just doesn't work - in such case VPN connection is established, internet avoids VPN but it fails to reach NAS server. Any suggestions?


You need to have a route to you NAS server that goes along the VPN. Having the default-route on the VPN is apparently a way to achieve that (depends on details of your networking configuration and environment).

Yes, "only use for local resources" configures the presence of the detault-route.

Often you get automatically specific routes to reach the resources on the VPN. If that doesn't happen, it could be a misconfiguration in the VPN server, on your side or a bug.

Regardless whether that works automatically, you can also add manual, static routes. Find out the IP address you want to reach (ping NAS-SERVER, or ask your admin). Possibly, you don't only add a route to that one IP address, but an entire subnet (like You can configure that in your NetworkManager GUI. Afterwards re-activate your VPN connection.

Check the assignes routes with ip route.

You might also try traceroute -n NAS-SERVER to see the way that your IP packets take.

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Next Post »