Skip to main content

How to Use Proxychains to Redirect Traffic Through Proxy Server


Sometimes we installed a proxy server, but only certain programs such as Firefox and Google chrome provide proxy settings. Luckily, we can use a command line utility called proxychains to redirect any program to go through our proxy server. This tutorial will show you how to set it up on Debian, Ubuntu, OpenSUSE, Fedora, CentOS/Redhat, Arch Linux and their derivatives.

If your don’t know how to set up a proxy server, then check out this post to learn the merits of shadowsocks proxy. After that, come back here.

Install proxychains

Debian/Ubuntu/Linux Mint/Elementary OS

sudo apt-get install proxychains

OpenSUSE Leap 42.1

proxychains is available from the packman repository.

sudo zypper install proxychains


sudo dnf install proxychains


sudo yum install proxychains


sudo pacman -S proxychains-ng

On kali linux, proxychains is installed by default.

Add a Proxy Server to Proxychains

Open the configuration file.

sudo nano /etc/proxychains.conf

At the end of the file, add your proxy like this

socks5   1080

socks5 is the proxy type, you can add other types as well such as http, https, socks4 etc. depending on your situation. is the proxy host, and 1080 is the port on which proxy server listens. Again, change them to your specific situation.

The default proxy is socks4 9050 which you can safely remove.

Set a Default DNS Server

It’s highly recommended that you change the default DNS server to something else, such as Google’s DNS server Or OpenDNS server Open the resolv configuration file.


sudo nano /usr/lib/proxyresolv

Linux Mint/Elementary OS

sudo nano /usr/lib/proxychains3/proxyresolv


sudo nano /usr/bin/proxyresolv

Find the following line


Change its value to something like Then save and close the file. On Arch Linux, there’s no proxyresolv config file.


Just prepend proxychains to any command you execute like the following.

proxychains youtube-dl -citw<channel-id>

If you are using youtube-dl then you may know that it has not built-in support for socks proxy, but Proxychains will redirect youtube-dl to go through the proxy server.

If you want to redirect all your terminal traffic through proxy server, then enter start a new shell program with proxychains, like below.

proxychains bash

This command will start another bash shell with proxychains in your terminal and from now on you don’t have to prepend proxychains to your command. Your traffic in this new shell will be automatically redirected through proxy server.

Note:  Terminal is different from shell. Terminal is the device that enable you to connect to a host computer whereas shell is a piece of software on the host computer. Shell is a command line interpreter, translating your command to zeros and ones so the computer can understand your command. When a terminal connects to a host computer, a shell program will be automatically started so that the user’s commands can be interpreted by the shell and the computer can understand the user’s commands.

Quiet Mode

By default, proxychains will output its activity to the terminal. If you don’t want to see this information, then you can disable it by editing /etc/proxychains.conf file.

sudo nao /etc/proxychains.conf

Find the following line


Remove the hashtag. Save and close the file. Now you will only see the output of the application that is being redirected.

As always, if you found this post useful, please subscribe to our free newsletter or follow us on Google+, Twitter or like our Facebook page

Rate this tutorial
[Total: 1 Average: 5]