I used to connect to a home server through a private VPN and I used it just to access phpMyAdmin and the MySQL database (from my application). When connected to the VPN, my internet speed was not changed at all, everything was alright.

I reinstalled my Ubuntu and set up the VPN connection again and now when I connect to the VPN, the net speed becomes suuuper slow. Can't open any page. I don't get timeouts, though, so I guess everything gets redirected through the VPN.

I am really not a networks guy, so I have no clue what to dig into. Any suggestions?

Outputs from route -n...

NOT connected to VPN: enter image description here

Connected to VPN: enter image description here

After calling the commands:

sudo ip route del default via
sudo ip route add default via dev wlan0

now the internet connection is not slowed down, but I cannot access the server to which I am connecting through the VPN. Isn't that because I am deleting the IP somehow? Here's a screenshot of the route -n output: enter image description here

P.S. the server IP changes between .5, .9 and .13.

  • can you put output from command route -n when vpn is connected and when is not? – 2707974 Aug 31 '15 at 14:03
  • It seems like you are routing the whole traffic through the VPN instead of only your home net. Try to setup your vpn in a way, that only (replace with your home network) is routed through the vpn. – Jakob Lenfers Aug 31 '15 at 14:06
  • @2707974, I updated my post. – Milkncookiez Aug 31 '15 at 14:09

Your routing table say that after connecting to vpn change default gw from to aka route all traffic through tun0 interface.

To avoid this you can add following

Create script for tun0 interface

sudo nano /etc/network/if-up.d/script

put in script this

    # Check for specific interface if desired
    [ "$IFACE" != "tun0" ] || exit 0
    # trigger vpn connection
    ip route del default via
    ip route add default via dev wlan0

Save and exit.

Make script called script with execute permissions 755

sudo chmod 755 /etc/network/if-up.d/script

This script will be triggered after tun0 interface go up and simple make wlan0 default interface for internet traffic.

Or, you can, after establishing a vpn connection in terminal run this commands,

First remove default gw the add new

sudo ip route del default via
sudo ip route add default via dev wlan0

but this is temporary and must be done every time when connect to vpn

Or, based on you setup, in /etc/network/interfaces in the part of config a tun0 interface add command


iface tun0 inet static
      --omited some config--

      address xxx.xxx.xxx.xxx
      pointopoint xxx.xxx.xxx.xxx
      netmask xxx.xxx.xxx.xxx
      up route add -net ..
      --omited some config--

      #change default gw
      up ip route del default via
      up ip route add default via dev wlan0

All of this way of configuration will back default route to wlan0 interface after vpn connection.

  • the first option was not working, so I tried the second one (which is the temporary one) and I got an error, directly in the terminal: Error: either "to" is duplicate, or "" is a garbage. I will investigate this now, but if you have the solution before me - let me know. – Milkncookiez Sep 2 '15 at 9:39
  • For now try only temporary solution again. I have typo mistake. One Space more between default and 192.... – 2707974 Sep 2 '15 at 9:48
  • Yeah, I noticed the typo already the first time when I tried it. :) But it doesn't work still... – Milkncookiez Sep 3 '15 at 8:54
  • I edited answer, try. – 2707974 Sep 3 '15 at 9:27
  • 1
    On witch ip is server? You can add more route to specific ip sudo ip route add 192.168.2.xxx/32 dev tun0 or range sudo ip route add dev tun0 – 2707974 Sep 7 '15 at 9:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.