Free easy way to hide IP in Linux

You may need to change IP for anonymity or bypassing restrictions. There are so many ready-made solutions and ways to do this. From this article, you will get to know how to change IP in Linux. You will be acquainted with a couple programs, which help you to hide you IP extremely easy and fast. In addition, absolutely free.

These two apps hide your IP in traffic from console applications and from graphical ones (web browsers, for example). But you should always remember about programs that can go online making low-level queries, bypassing system functions. An example of such a program is Nmap.

To check my IP in the console I will use the command:


And to check IP in a web browser, I'll go to the page, which besides IP shows the location on the map, as well as the Internet provider.

Automatically connect to a free VPN

The first program is called autovpn. The essence of her work is that she gets a list of free VPN servers from the site and connects through one of them. It is possible to explicitly specify the country whose IP you need.

The program must be installed before use. Since it is not found in the standard Kali Linux repositories, we need to compile it from the source code. It's not difficult at all, but the autovpn program is written in the Go programming language, so you need to start by installing the Go compiler.

Open the .bashrc file in the user directory with any text editor:

gedit ~/.bashrc

And to create new environment variables, add the following lines to this file:

echo 'export GOPATH=/home/git/go' >> ~/.bashrc
echo 'export GOROOT=/usr/local/src/go' >> ~/.bashrc
echo 'export PATH=${PATH}:$GOROOT/bin' >> ~/.bashrc

When you are ready, save your changes and close the file.

These changes will take effect after the reboot. Instead of restarting the computer, run:

source ~/.bashrc

The following command automatically detects and downloads the latest version of the Go language files:

wget `curl -s | grep -E -o 'https://[a-z0-9./]{5,}go[0-9.]{3,}linux-amd64.tar.gz' | head -n 1`

Extract the downloaded archive:

tar zxf go*.linux-amd64.tar.gz

Change the directory to $GOROOT, which we specified in ~/.bashrc.

sudo mv go $GOROOT

To connect to VPN servers, the autovpn program uses openvpn. Install this package if it is not on your system:

sudo apt-get install openvpn

Next, install autovpn:

git clone
cd autovpn
go build autovpn.go
sudo mv autovpn /usr/local/bin/

Everything is ready. If the Go compiler is no longer needed, you can remove it from the system.

The program does not have options. As argument you enter ISO 3166-1 alpha-2 (the two-letter country code, through whose VPN you want to connect).

If after starting the program quickly quits without connecting to the VPN, this could mean:

  • You entered the country code incorrectly
  • Missing VPN from selected country

You can give a country if you want. For example, if you want to connect to a server in Japan:

sudo autovpn JP

Проверьте свой IP в консоли и веб-браузере.

To stop using VPN, press CTRL + c. The program asks if you want to try another VPN, if you want to reconnect via another VPN server, then press y, if you want to quit the program, type n.

Now each time you want to change the IP simply run:   

sudo autovpn


sudo autovpn COUNTRY_CODE

If the country code is not specified, then the program tries to connect to the VPN from the US (sometimes not available – so just select any other country).

Command to redirect all traffic through Tor

The second program I want to talk about is called TorIptables2. TorIptables2 routes all traffic on a standalone machine through Tor. Once this is set up, every network application will make its TCP connections through Tor; no application will be able to reveal your IP address by connecting directly.

To run the program you need installed and running Tor:

sudo apt-get install tor
sudo systemctl start tor

If you want, you can add the Tor service to startup:

sudo systemctl enable tor


git clone
cd toriptables2/
sudo mv /usr/local/bin/
cd -h

Program options:

-h, --help   show this help message and exit
-l, --load   This option will load tor iptables rules
-f, --flush  This option flushes the iptables rules to default

To redirect all TCP traffic over the Tor network, run:

sudo -l

For direct Internet connections (without using the Tor network) run:

sudo -f

The Tor network works so that your external IP changes from time to time. If you want to change it immediately (if you do not like the country that dropped out, or if the Tor node is too slow), then run the command:

sudo kill -HUP $(pidof tor)


Both programs require a small installation, but once configured, you can change your IP at any time in seconds, choosing IP from any country, or using the Tor network for communication. Both of these methods allow you to bypass restrictions based on IP.

Recommended for you:

Leave a Reply

Your email address will not be published.