L2TP / IPSEC VPN on Ubuntu 16.04

So for work, we use an LT2P IPSEC vpn which works simple and easily with both Android and Windows 10. Unfortunately as many people likely know (after a few google searches it seems) the client for this is pretty crap in Ubuntu 16.04.

The two main packages for this is strongswan and xl2tpd. There is apparently some network manager plugins that will allow you to configure a VPN connection directly where you would setup a Wi-Fi or LAN connection using a GUI, but unfortunately, these don’t allow me to enter the correct information to use the VPN the way we have it setup.

Our setup uses a shared PSK, and a username and password.

(more…)

Turning a netgear r7000 into an augmented traffic control router

At work we’re developing apps that are being used in developing countries and half of the office works out of Vancouver where our networks are very good. Unfortunately, this means that we often don’t think about user experience problems and bugs that occur only when the app is operating with a poor quality connection.

To combat this, we are taking motivation from Facebook, which offers “2G Tuesdays” to employees so they can experience what it’s like for people in other parts of the world. Facebook also released a tool call Augmented Traffic Control which allows you to simulate these types of conditions with your own equipment.

At our office, we’d like to have a dedicated device that provides this – and I had an old netgear R7000 router at home. Here’s a bit of a guide on how to get everything up and running.

(more…)

Ubuntu / Raspian / Rapsberry Pi Connection Problems

So today I was messing around with a Raspberry Pi using Raspian. It turns out if you have an ethernet connection without Internet and a Wi-Fi connection with Internet, the Pi / Raspian is too dumb to figure out that it should use the Wi-Fi connection for things like dns lookups and web traffic. Slightly annoying. I’m sure there’s a way to fix this – but time is not on my side today.

Update: It turns out it’s more of a widespread linux problem. This morning on Ubuntu I tried connecting one Wi-Fi adapter to an AP that was not connected to the Internet and a second one that was. It seemed that again the traffic tried to take the path through the first adapter.

Ubuntu: Script to Check Internet Connection and Repair

At school there are a set of laptops which I occasionally run experiments on for my research. I usually like to work remotely as I travel a bit and live in other cities. These laptops are all connected to the university network through a wireless AP in my office which passes the DHCP requests to somewhere in the department. This lets each one get an external IP which is extremely useful for SSH-ing into the machines one at a time remotely. However sometimes, for unknown reasons the IPs revert back to 10.x.x.x addresses and aren’t reachable. The problem can be solved by releasing the old address a couple of times:

sudo dhclient -r wlan1
sudo dhclient -r wlan1

and then asking for a new address:

sudo dhclient wlan1

However, this isn’t too helpful if I’m out of the lab. So to automate this I came up with this script which can be turned into a cronjob:

(more…)

Updated DNS Zone Update tool for Hostmonster

A couple years ago I posted a slightly modified script for hostmonster to update the dns zone entries for subdomains. It used mechanize and ruby. However, since then my script broke as hostmonster made some changes to their backend. Another guy made some changes that seemed to work for a while, but again it has broken. My previous post about this is here.

The culprit seems to be the mixture of javascript / ajax and the fact that hostmonster returns an empty page when you append the /ajax onto the dnszone url. No worries though, I found another way to do it.

Using Watir and Headless, it is possible to achieve the same functionality.

You need to add a few things to ubuntu to make it work:
sudo apt-get install ruby ruby-dev xvfb
sudo gem install watir
sudo gem install headless

Here’s the updated script (note, you can still use the same cron jobs and ip scripts etc. from the previous two techniques.:

#!/usr/bin/ruby
(more…)