Published on

Routing Web Traffic with a SOCKS Tunnel


I wanted to access a Non Standard HTTP Port on one of my RaspberryPi Hosts, which was not directly available to the Internet, so I have chosen to establish a SOCKS Tunnel to achieve that.

Web Application on my LAN

Getting my RaspberryPi's Private IP Address:

ifconfig eth0 | grep 'inet 192' | awk '{print $2}'

For demonstration purposes, I will use Python's SimpleHTTPServer:

mkdir web
cd web
echo 'yeehaa' > index.html
python -m SimpleHTTPServer 5050
# Serving HTTP on port 5050 ...

Establish the SOCKS Tunnel

From my laptop, establishing the SOCKS Tunnel with SSH, you can use -f to fork it in the background:

ssh -D 8157 -CqN

Configure your Browser:

Configure your browser to Proxy via:

  • Host: localhost
  • Port: 8157

Now when you access the destined host's private ip, you will get a response:

Browse to and in my case my response is:
-> yeehaa

Thank You

Thanks for reading, feel free to check out my website, feel free to subscribe to my newsletter or follow me at @ruanbekker on Twitter.