Get free Internet Wifi hotspot - Tunneling HTTP over DNS

From time to time you may require urgent access to the internet and you don’t have your credit card handy / you’re broke / or you just like getting things for free 🙂 This is a quick and simple tutorial which explains how to get free Internet at public Wifi hotspots.

Prerequisites

  • You will need a laptop with Linux / Mac installed (this will be used to connect to the public wifi hotspot) – Machine A
  • You will need a separate machine with permanent Internet access at your house / office – Machine B

Step 1 – Install Iodine

sudo apt-get install iodine

This installs a neat little tool called Iodine which makes everything possible. You will need to run this command on Machines A and B (see prerequisites above).

Step 2 – Get a dynamic hostname

Unless you have a static IP address, you will need to register for a free domain name. Your ISP (Internet Service Provider) allocates different IP addresses to your router periodically. As such you cannot use your current router IP. With that said, you will need to attain a free hostname and a tool which allows you to map your constantly changing router IP address to the hostname. You can register for a free hostname here:

http://www.noip.com/free

You will then need to insert your login details from above in the DDNS section of your router. This essentially allows the router to send your updated IP address to the noip.com which enables you to reach your router by going to yourname.no-ip.info. Should your router not have an option in the DDNS section for noip.com, you can follow the guide below to enable this process from Machine B.

http://www.noip.com/support/knowledgebase/installing-the-linux-dynamic-update-client-on-ubuntu/

Step 3 – Start Iodine server on Machine B

You have to start Iodine on Machine B by executing the following command:

iodined -f -P yourpassword 192.168.2.6 yourname.no-ip.info

The IP address above must not be in use on your network and must be in the same IP address range as the rest of your network.

Step 4 – Forward requests on port 53 to Machine B

Although Iodine is running on Machine B, there is no way for the DNS requests to reach Machine B. You have to login to your router and go to the port mapping / port forwarding section and forward all inbound requests on port 53 to Machine B’s IP address (not 192.168.2.6 as shown in the command in Step 3). Port 53 is the default DNS port.

You can check if you have set everything up correctly by visiting:

http://code.kryo.se/iodine/check-it

Step 5 – Start Iodine on Machine A

Issue the following command on Machine A (your laptop connected to the wifi hotspot):

sudo iodine -P yourpassword yourname.no-ip.info

If all is setup correctly, you should be able to ping 192.168.2.6 (or whatever IP you used in step 3).

Step 6 – Install SSH server on Machine B

In order to setup a SOCKS proxy you will need to install an SSH server on Machine B:

sudo apt-get install openssh-server

Step 7 – Setup SOCKS proxy

Execute the following command to setup a SOCKS proxy on Machine B:

ssh user@192.168.2.6 -D 1080

The **user **in the above command is the user for Machine B. The IP address used here for Machine B (192.168.2.6) is the same as the IP address specified in step 3. Not only will this allow you to use a SOCKS proxy, but all your traffic will be encrypted over SSH.

Step 8 – Surf for free 🙂

The final step is to set the proxy settings for your browser to tunnel traffic securely over SSH on the port specified in Step 7 (8080). The SOCKS host to be used will be localhost. Configuring your browser to use a SOCKS proxy is beyond the scope of this tutorial.