I have following problem: I need to connect to VPN and access specific resources (ip addresses). When I connect to VPN all network traffic goes through VPN but in fact I need only specific destinations to be accessed over VPN and the rest of the traffic to go through default route and avoid VPN.
Here is the result of netstat -nr
Before I connect to VPN:
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 192.168.0.1 UGScI 19 0 en1
After I connect to VPN:
Routing tables
Internet:
Destination Gateway Flags Refs Use Netif Expire
default 10.1.1.1 UGSc 123 3744 jnc0
default 192.168.0.1 UGScI 19 0 en1
So as you can see I have 2 default routes after VPN connected. All internet traffic goes through the first default route which is undesirable behaviour.
Is there a way to set priority for the default route? So all traffic by default doesn't go through VPN but only manually created routes redirect to VPN i.e. sudo route -n add 172.0.0.1 10.1.1.1