DEV Community

De
De

Posted on

Internet Everywhere - DNS Tunnel πŸš‡

DNS Tunnel is a great tool for accessing the internet even in the most unlikely places.

At times, you may encounter a faulty internet connection, down for maintenance, filtered by a firewall;
a DNS tunnel can connect you to the internet, and is quite simple to create one.

Pre-requisites

You need a domain name, a VPS and Iodine.

Iodine is the software we will use to tunnel internet data.

Install Iodine

Install Iodine (hyperlink above) in both your server and your personal device, Iodine supports Android, Linux, and Windows.

You may also use a package manager

$ apt install iodine

$ yum install iodine-server

$ pacman -Sy iodine

Set up

Access your domain registrar (eg. Namecheap or Godaddy) DNS dashboard:

  • Add a DNS record of Type "A", with Name "t1ns" and Data/Value YOUR_VPS_IP

where "YOUR_VPS_IP" is the actual IP of your VPS.

  • Add a DNS record of Type "NS", with Name "t1" and Data/Value t1ns.YOUR_DOMAIN

where "YOUR_DOMAIN" is the domain you acquired from step 1.
The result should look similar to the image below:

DNS records preview

Tunnel data

Make sure the DNS records have propagated:

$ nslookup t1ns.YOUR_DOMAIN

The command above should return your server IP.

$ dig A t1.YOUR_DOMAIN

The command above should confirm the DNS record delegation.

Let's create the tunnel:

  • Run iodined (note the "d") on your server

$ iodined -f -P My_Super_Password 10.0.0.1 t1.YOUR_DOMAIN

the IP "10.0.0.1" in the command above can be replaced with another free private reserved IP. You may leave it as it is.

  • Run iodine on your device

$ iodine -f -P My_Super_Password t1.YOUR_DOMAIN

the "-f" option instructs Iodine to run in foreground.

You should be able to reach your server through 10.0.0.1.

Finally, you can establish an SSH SOCKS5 proxy connection to your server, happy surfing.

$ ssh SERVER_USERNAME@10.0.0.1 -D PORT

Discussion (0)