Linux – How to setup Ubuntu/Linux’s Network manager to selectively route network traffic through the VPN

linuxroutingUbuntuvpn

I'm using Ubuntu 9.04 and I just noticed that ALL of my network traffic is being routed through my VPN. I would like the VPN to route only the traffic hitting servers on the VPN and then connect directly to anywhere else on the internet as needed. The VPN is PPTP VPN that is run using some sort of Microsoft stack.

Results from route command:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
102-102-152-203 192.168.24.1    255.255.255.255 UGH   0      0        0 wlan0
192.168.24.0    *               255.255.255.0   U     2      0        0 wlan0
link-local      *               255.255.0.0     U     1000   0        0 wlan0
default         *               0.0.0.0         U     0      0        0 ppp0

Best Answer

For my Cisco Compatible VPN in Ubuntu 9.04 (VPNC), there is a check box to select.

Edit your connections, go to the VPN tab, and edit the VPN configuration.

Go to the IPv4 Settings tab, and in the bottom right is a button "Routes".

Click the button and check the box "Use this connection only for resources on its network"

As others have mentioned, there are text based configuration files one can alter instead of using the GUI. One nice thing about GUIs is that you don't have to memorize all the possible values or worry about spelling

Related Question