Send Ad Free SMS in India

Pull up your socks – The magic of tsocks…

October 30, 2009 | In: Browsers, GNU/Linux, Hacks, How-To

So if you are in a same situation as mine, you probably…

  • Are on an MNC’s intranet which is being simultaneously used by a ton of other souls
  • Get pathetic internet speeds, at times – measurable sometimes in BYTES!
  • Even “git pull” takes like ages to complete…
  • Any connection to Twitter is severed before it even sees light of the day!

The solution to all these worries is simpler than you think.

We can create an SSH tunnel to a *much* faster server and push our internet traffic over it. If the server is local, this will work even better – as your SSH on local LAN connections would be definitely faster than that on real WWW.

Follow http://wiki.freaks-unidos.net/weblogs/azul/firefox-ssh-tunnel and create a tunnel on any port. Lets call it $PORT
Basically, you need to run…

ssh -fND localhost:$PORT username@some-fast-server.com

Install tsocks – its a Transparent SOCKS Proxying Library which uses the magic of LD_PRELOAD and patches the connect() call to appropriately use a pre-configured proxy (via /etc/tsocks.conf). Hence any call like…

git pull

becomes

tsocks git pull

Your /etc/tsocks.conf looks something like this (after removing all the comments)

#Define a local network for which tsocks won’t patch the connect() call
local = 192.168.0.0/255.255.0.0

path {
reaches = 0.0.0.0/0.0.0.0
server = 127.0.0.1
server_type = 5
server_port = $PORT
}
server = 127.0.0.1
server_type = 5
server_port = $PORT

Replace the $PORT by the port you selected when creating the SSH tunnel. Server remains 127.0.0.1 as your tunnel exists on your own machine.

To configure your Firefox to use this new tunnel, goto Edit > Preferences > Advanced > Network Tab > Settings and make it look like

Connection Settings
Add URL’s and IP ranges to “No Proxy for” field to exempt them from using the SSH tunnel.

That’s it. Click OK and you are ready to rock!

Post to Twitter Post to Delicious Post to Digg Post to Facebook Post to MySpace Post to Reddit Post to StumbleUpon

Related posts:

  1. How to setup a remote GIT repository and play with branching Given, you are a new GIT user/admin and want to...
  2. OMG! Chrome-4.0 is nearly 59% and 76% faster than Firefox-3.7a1pre on my T61 (Ubuntu Jaunty) Okay, to start off – I really wanted Firefox to...
  3. How to install Firefox Addons on Minefield – Bleeding edge nightly builds for firefox Using Minefield – the nightly firefox build – and yet...

Related posts brought to you by Yet Another Related Posts Plugin.

Comment Form

blog comments powered by Disqus