Everytime I ran the sudo command, it took about 3-10 seconds to ask for the password. I found that the reason for this is that sudo does a DNS lookup. There was a problem with my /etc/hosts file. I had changed the hostname of the computer without updating the /etc/hosts file. The fix was to add a record for my computer. For example:

We have a Synology Rackstation NAS and it comes with a VPN server. I decided to try and work out how to connect my Ubuntu laptop to the Synology VPN server and route my network through that. It took me sometime to get the settings right, so I have put together a guide in the hope that it helps someone else.

Step 1 – Install the server
I installed the VPN server. You can find instruction on how to do this on the Synology website.

You should name the connection, then enter the VPN server IP address or domain name. You will also need to add your username and password exactly the same as on the Synology server. Note: Don’t put anything in the NT Domain field. This isn’t required and will stop the client authenticating. Other how to suggest that you do this – it isn’t required for Synology.

Final Tweaks
You can then tweak the advanced settings to make sure the client runs as securely as possible. Here are the settings that I used:

Enable Your VPN Connection
To enable your the VPN connection you should click on the Network Manager -> VPN Connections -> Select your VPN connection. You will know that the VPN connection is working when the network icon has a little padlock. You don’t need to reboot your computer to make this connection work.

If you have problems then I recommend tailing the /var/log/syslog to debug.

I’ve recently been visiting China and have been caught out by their Firewall. This hasn’t be too bad but Google Mail and Google Drive is really slow or intermittent. Also you can’t access YouTube or the BBC IPlayer. The final straw for me was for some reason they have blocked the Ubuntu Dropbox repository – so you can’t install Dropbox either.

I don’t have VPN account but we do have some servers. Therefore, I decided to route all the network traffic through one of our server.

I tried various options and final settled on sshuttle because I needed to route everything and not just Firefox. Sshuttle is a transparent proxy server that forwards over a SSH connection and sets up a proxy by running Python scripts on the remote server. I’m assuming your are running Ubuntu on both the client and the remote server. You will need administrative privileges on the client.

sudo apt-get install sshuttle

To route all traffic through sshuttle (except DNS):

sshuttle -r username@sshserver:port 0/0

You will then need to enter your password on your client and then the password for the remote machine. To help debug run sshuttle in verbose mode with the -v flag. The -r flag is the remote host (and username). The port 0/0 is short for 0.0.0.0/0 that represents the subnets to route over the VPN. The usage of 0/0 routes all the traffic except DNS requests to the remote server. If you need to tunnel your DNS too then add the -H flag.