Warning : This post is my own note, you may believe on it or not.
Before continue read this post, I recommend you to read this post as preface.
Linux / BSD user usually familiar with shell, and wget is very usefull tool for download from shell. In this post I will explain how can wget use SOCKS proxy.
What is socks ?
From wikipedia “SOCKS is an Internet protocol that facilitates the routing of network packets between client–server applications via a proxy server. SOCKS performs at Layer 5 of the OSI model—the session layer (an intermediate layer between the presentation layer and the transport layer).”
Ok, this is the step.
- Create the tunnel (from another tty or ttyv or terminal). I use ssh to create tunnel on localhost port 9999. You may create the tunnel with ping tunnel (ptunnel) or another tools.
- Check wheather the tunnel successfully created or not.
- install tsocks
- configure tsocks, uncomment every line, except three lines below, and
- Try to download with wget
lqman@development:~$ ssh -D 9999 -C lqman@180.247.xxx.xxx
lqman@180.247.xxx.xxx's password : xxxxxxxx
-D : bind on spesific port
-C : compress the connection [optional]
lqman@development:~$ sudo netstat -atupln | grep 9999
tcp 0 0 127.0.0.1:9999 0.0.0.0:* LISTEN 13680/ssh
tcp6 0 0 ::1:9999 :::* LISTEN 13680/ssh
if the LISTEN state appear, it means the tunnel has created successfully (on locahost port 9999) and ready to use.
lqman@development:~$ sudo aptitude install tsocks
lqman@development:~$ sudo vim /etc/tsocks.conf
server = 127.0.0.1
server_type = 5
server_port = 9999
lqman@development:~$ tsocks wget google.com
--2011-05-29 16:56:59-- http://google.com/
Resolving google.com... 74.125.71.105, 74.125.71.106, 74.125.71.147, ...
Connecting to google.com|74.125.71.105|:80... connected.
HTTP request sent, awaiting response... 301 Moved Permanently
Location: http://www.google.com/ [following]
--2011-05-29 16:56:59-- http://www.google.com/
Resolving www.google.com... 74.125.71.106, 74.125.71.147, 74.125.71.99, ...
Connecting to www.google.com|74.125.71.106|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.google.co.id/ [following]
--2011-05-29 16:57:00-- http://www.google.co.id/
Resolving www.google.co.id... 74.125.71.105, 74.125.71.106, 74.125.71.147, ...
Connecting to www.google.co.id|74.125.71.105|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: unspecified [text/html]
Saving to: “index.html”
[ ] 10,182 37.5K/s in 0.3s
2011-05-29 16:57:01 (37.5 KB/s) - “index.html” saved [10182]
Thats all folks….
Happy tunnelling & downloading dude.
reference :
http://www.dslreports.com/forum/remark,13563828
man wget
