Operating Systems, Technology, Tutorials

How To Route All Traffic On Kali Linux Through Tor Using Whonix

October 12, 2016

Kali Linux routed through Tor

Kali Linux’s connection can be wholly torified utilizing the Whonix Gateway which makes IP and DNS leaks unfeasible to the malicious actor.

For the purposes of this tutorial, we only require the Whonix Gateway, Kali Linux, and VirtualBox. You can ignore the general requirement of the Whonix Workstation since Kali Linux will act as the preferred replacement instead.

Kali Linux will, therefore, not merely be transformed into a completely isolated network (like the Whonix Workstation) but also solely accept connections made through Tor. You will use VirtualBox to run both of these virtual machines on your computer.

This article is split into three sections: Install Whonix Gateway, Install Kali Linux, and Adjust VirtualBox Settings of Kali Linux. If you already have installed Whonix Gateway and Kali Linux in VirtualBox, you can skip to the last section which places emphasis on altering your VirtualBox settings. (Notably, changing the Adapter 1’s settings so Kali Linux is able to entirely route through Whonix Gateway and editing network settings in Kali Linux to help facilitate this process.) In this case, you may refer to steps 15, 16, and 17 of the section Adjust VirtualBox Settings of Kali Linux.

Install Whonix Gateway

1. Download Whonix Gateway

Go to Whonix’s official download page (here) and download Whonix Gateway. Make sure to verify the .ova image after you finished downloading it using the Signing Key.

2. Import Whonix-Gateway.ova file

Depending on of your host’s OS, the VirtualBox Appliance to import window will show one of the two following messages when you hover on the import button: “Choose” or “Choose a virtual appliance file to import.” Click on the button. A new window will appear. Now select the freshly downloaded Whonix-Gateway.ova file and click “Open.” Proceed by clicking “Next” and then “Import” without altering any settings. A progress bar will be shown when importing.

3. Commence Whonix Gateway

Go to VirtualBox and double click on the Whonix-Gateway.

Login to Whonix. Remember the default username is user. And the default password is: changeme

4. Update Whonix Gateway

Make sure to retrieve and install the latest Whonix operating system updates by typing in the terminal: sudo apt-get update && sudo apt-get upgrade

5. Reboot Whonix

Restart Whonix after the latest updates are installed and after the initial setup is complete.

6. Leave the Whonix Gateway virtual machine up.

Don’t shut down the virtual machine. We will need Whonix continually up for it to act as a TOR router, hence significantly enhancing our anonymity in the process.

Install Kali Linux

1. Create a new Virtual Machine

In VirtualBox, click on “New” so we can create a new Virtual Machine.

2. Create a name for your Kali Virtual Machine

In the name section, type in a name like “Kali Linux.” The Type section will likely show “Linux” and the Version section something like “2.6”. We can ignore those other sections for now.

3. Assign Memory (RAM)

The recommended memory is 256 MB. For better performance, let’s choose 1050 MB by typing the number in the white box.

4. Create a Virtual Hard Drive

In the “Create Virtual Machine” screen, we are presented with the option of “creating a virtual hard drive now.” Choose that and click “Create.”

5. Choose the Hard Drive File type (It is virtual, of course)

Choose “VDI” (VirtualBox Disk Image) and click “Next.”

6. Choose Dynamically allocated hard drive type.

Select “Dynamically allocated” and click “Next.”

7. Choose the size of the virtual hard drive.

Alter the size of the virtual hard drive to anything from “15.00 GB” to “30.00 GB” Note: We are not going to be using the disk size immediately since we chose “Dynamically Allocated” earlier for our storage. But you should at least be allocating 15 GB to the virtual hard drive to smooth things out and avoid potential installation errors.

NOTE: You can skip steps 15, 16, and 17 of the section Adjust VirtualBox Settings of Kali Linux if you have already inserted the correct information into the first part of the Kali Linux Graphical Installation which is:

address 10.152.152.11
netmask 255.255.192.0
gateway 10.152.152.10
nameserver 10.152.152.10

This is more convenient since it does not require the use of the file editor or the command: ifup eth0.

Adjust VirtualBox Settings of Kali Linux

You should now be in VirtualBox. If not, open it up again.

1. Go to settings after selecting your Kali virtual machine from the list in the main window “Oracle VM VirtualBox Manager”?

Select “Settings” which is the second button in the main window after clicking on the new Kali virtual machine on the left. (The first being “New”)

2. Choose the General section towards your left list in the settings window.

By default, you should already be in the General section of the Settings window when you first clicked on “Settings” from the previous step. On your right, you will see three tabs: “Basic,” “Advanced,” “Description.” Choose “Basic.” You will see “Version” under this tab. If the ISO that you downloaded is 64 bit, then choose “Debian (64 bit)”. If the ISO is 32 bit, then choose “Debian (32 bit)”

3. Select System > Processor

In the Settings window, click on “System” on your left and click on the “Processor” tab on your right. You should change the number of processors your computer will utilize for the virtual machine. This window will show you the number of processors your computer has. Try to increase the number of processors by a little, but not too much. The key is to even it out.

4. Select Display > Video

In the Settings window, click on “Display” on your left and click on the “Video” tab on your right. Choose “128 MB” for your Video Memory. Type in “128” in the white box. And tick the box “Enable 3D Acceleration”. These changes will increase the stability of your virtual machine, therefore rewarding you with a more responsive and enjoyable experience.

5. Storage > Controller: IDE > Empty (CD Icon)

In the Settings window, click on “Storage” on your left and click on “Video” tab on your right. Highlight the Empty CD icon. Choose “IDE Secondary Master” on the right after CD/DVD Drive. Click on the CD icon on your right and choose your Kali Linux ISO. (This icon looks identical to the one on the left.)

6. Edit the Network settings

Select “Internal Network” in the “Adapter 1” tab: “Attached to: Internal Network” and type in the name “Whonix” which is just below.

7. Boot the Kali Linux ISO

When you are in the boot menu, select “Graphical Install.” Most of the set-up after this is self-explanatory. Thus, we will skip to the disk partitioning part. Disk partitioning may intimidate some new users. But we are using VirtualBox, so we aren’t concerned with messing things up.

8. Choose “Guided – use entire disk” and select “Continue.”

9. Choose disk to partition

There should be only one disk on this screen called “VBOX HARDDISK.” Select it and click on “Continue.”

10. Choose the partitioning scheme

Choose “All files in one partition” and select “Continue.”

11. Partition disks

Choose “Finish partitioning and write changes to disk” and select “Continue.”

12. Yes > Continue

You will be presented with the question: “Write changes to disks.” Choose “Yes.” and select “Continue.”

13. Install GRUB boot loader

We have skipped a couple of steps after the previous step since it is self-explanatory. You will be presented with the question: “Install the GRUB boot loader to the master boot record?” Choose “Yes” and click on “Continue.”

14. Finish the installation

When the installation has finished, click on “Continue.” The virtual machine will now reboot.

15. Edit /etc/network/interfaces

In Kali Linux, add the following information to the bottom of /etc/network/interfaces:

iface eth0 inet static
       address 10.152.152.11
       netmask 255.255.192.0
       gateway 10.152.152.10

16. Edit /etc/resolv.conf

In Kali Linux, replace everything in /etc/resolv.conf and add the following information:

nameserver 10.152.152.10

17. Go to Terminal

Type in the following: sudo ifdown eth0

and

sudo ifup eth0

18. Verify that Kali is connected to Tor via the Whonix Gateway

Go to https://check.torproject.org. The message presented by the website should be: “Congratulations. This browser is configured to use Tor.”

You Might Also Like

Back to top
%d bloggers like this: