This post is originally posted in Indonesian on my other blog: http://blog.badwi.my.id/internet/tips-bagi-pengguna-ubuntu-pengguna-internet-tri-122. Here I wrap up it in English.
Sometimes, we need a proxy to bypass internet filtering. When we work in command line environment, it may not as simple as in graphical environment. But thanks to proxychains, it becomes so simple that we just need to put
proxychains command before the commands we want to execute. Proxychains is available in Ubuntu repository. So, we just have to run
sudo apt-get install proxychains to install it.
Proxychains can handle several proxy types, including SOCKS5 proxy. It is an SSH tunneling proxy. So we need a remote machine which allows us to login and access internet. That’s usually a VPS. So, we need to connect to SSH and make a tunnel before using proxychains.
ssh -vfCND1080 -l login_name -p port remote_machine_address
vargument makes verbose output, so you may ommit it
fargument makes ssh session run in the background
Cargument enables compression for all data
Nargument disables remote command to the machine we connect
D1080means to make local dynamic listening poxy at port 1080
login_nameis the username of our remote machine
portis the SSH port of remote machine, usually 22
remote_machine_addressis the address of our remote machine, either IP number or domain
Once connected, we can now use proxychains to bypass internet blocking. But first, we need to configure the proxychains in order to use our tunnel proxy. Edit the
/etc/proxychains.conf file. Make sure you have these lines uncommented.
strict_chain proxy_dns tcp_read_time_out 15000 tcp_connect_time_out 8000 [ProxyList] socks5 127.0.0.1 1080
We can also make a per-user config file at
$HOME/.proxychains/proxychains.conf. Then we can make use of proxychains in every command we execute which needs internet. For instance:
sudo proxychains apt-get update