How to prevent Firefox from connecting to the internet through VPN

Posted on

Problem :

I’m connecting to my university intranet through their VPN service. So whenever I activate VPN, I get an extra “ppp0” interface in addition to the already existing eth0 (wired), wlan0 (wireless) and lo (localhost) interfaces. It seems that, like all the other applications, Firefox connects to the internet through ppp0 when I activate VPN. I want it to connect through any interface except ppp0. How and where can I indicate this?

I’m running Ubuntu 12.04 on my laptop so I’m looking for a Linux solution to this.

Edit: Here’s the output of the command “route -n” as requested by MariusMatutiae

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
0.0.0.0         0.0.0.0         0.0.0.0         U     0      0        0 ppp0
10.200.5.51     0.0.0.0         255.255.255.255 UH    0      0        0 ppp0
138.40.178.1    192.168.1.1     255.255.255.255 UGH   0      0        0 wlan0
138.40.178.1    192.168.1.1     255.255.255.255 UGH   0      0        0 wlan0
169.254.0.0     0.0.0.0         255.255.0.0     U     1000   0        0 wlan0
192.168.1.0     0.0.0.0         255.255.255.0   U     2      0        0 wlan0

Thanks!

Solution :

What you should do is not put the default route to VPN/ppp0 which is most likely what you are doing but put to the VPN/ppp0 route just the host/network you really need to route over that link (ie. just the addresses/networks that are in the university intranet).

How to do this depends a bit on the VPN you are using. For example if the vpnc software you should check the “Target networks” directive that tells what networks to forward on it (and probably also set “DNSUpdate no” so you don’t change your DNS servers) instead of putting the default gateway (that is forward all the traffic)

Otherwise you could give a look to Linux Network Namespaces which may be even more advanced for you case, but check this article out: http://www.evolware.org/?p=293.

Leave a Reply

Your email address will not be published. Required fields are marked *