This blog is NOT OFFICIAL website of Kali Linux. We just share Tutorials to learn Cybersecurity.

Hosting a Local Website with Domain Name on Kali Linux over WiFi

In today's detailed tutorial we will learn how we can host a website from our Kali Linux machine over WiFi and other WiFi users able to see the website and download files directly from our Kali Machine. We also assign a domain name to our localhost website.

localhost website with a domain name

In our previous articles we have discussed hosting a website on localhost, same we will do here. First we start our Apache2 service by using following command:

sudo service apache2 start

This command may prompt for our root password, after giving the root password our Apache2 server will start. We can check whether this started or not by entering in our Kali Linux's browser. is the IP address of our localhost.

apache2 default page

Other devices connected in the same WiFi router can also visit this page but not with the localhost ( IP address. In those devices we need the local IP address of our Kali system assigned by our router. To check the IP we type ip addr command (ifconfig is getting old) in our Kali Linux machine's terminal.

ip addr
ip addr in the place of ifconfig
wlan0 IP address highlighted
In the above screenshot we can see our local IP address in the highlighted field.

Using this IP address we can see this webpage from any device connected with same router.

apache 2 default page from kali to mobile
Kali Linux's localhost on Mobile

Now we change our website as per we need. We will use a sample website for our tutorial example. User may create their own as per requirement.

First we need to edit the index.html file in our /var/www/html directory. To do that we use following command in our terminal:

sudo mousepad /var/www/html/index.html

Default Apache2 page's HTML code is here. We will change this as per our need.

We have designed our page for an example as we can see in the following screenshot.

html codes in /var/ww/html/index.html
html codes in /var/ww/html/index.html
After making our webpage in HTML, or PHP we save the file and close  it.

Then we visit the webpage from another device (Connected in same WiFi) by just entering the IP address of Kali Linux machine as we can see in the following screenshot.
Accessing the same webpage on phone
Accessing the same page from Phone
Not only accessing the webpage we can paste any file on our that directory and download those files on any other device connected on the same WiFi network.

For becoming non-root user default (in Kali 2020 update) we usually can't paste any file on system directories. So we need to open our file manager with root access by using following command:

sudo thunar
Then the file manager opens with root permission and we can copy our files from a directory to another using this file manager window (we can open another tab to use drag & drop). Here we put multimedia files in our /var/www/html directory.

root on thunar file manager
File manager on root permission to change system files

Now we can download the files in other device by entering the IP and file name as shown in following screenshot:

localhost files in mobile device

So we have created our localhost website and it can be accessible from other devices in the same WiFi network. We can download files over WiFi. This is very easy and we have done it in our previous articles.

Now we point a Domain name to this IP address. Then we don't need to type the boring IP address all the time.

We use ettercap graphical tool to do this, ettercap comes pre-installed with Kali Linux or can be downloaded on any Debian based system (Ubuntu, Parrot) by using following command:

sudo apt-get install ettercap-graphical
Now we go to the ettercap directory in our Kali Linux system. To do that we apply following command in our terminal window:

cd /etc/ettercap

Here we check the files using ls command.

cd /etc/ettercap && ls

We do some changes in the etter.dns file to point our domain name. Let's open this in a text editor like mousepad or nano by running following command:

sudo mousepad etter.dns
This will open a file like following screenshot:

etter.dns file opening

Here we scroll down to Microsoft part as shown in following screenshot:

etter.dns file configuring big
Add a line above the
Then add a line just above the line. The line will be following:

kali.onion   A

We can see the changes in the following screenshot:

pointing a domain name to our localhost
We just added one line in this section

Here kali.onion will be our URL pointing to (IP address of our Kali Linux machine) in our case. We can choose any other domain name if we want, but will not work if our router is connected with the internet, because is a SSl encrypted site. It's better to choose a .onion domain extension.

Now we save and close the etter.dns file and open Ettercap graphical by using following:

sudo ettercap -G
Then it will open the Ettercap as shown in the following screenshot:


Then we click on the ✔️ symbol to start the unified scanning. Here by default the network interface is wlan0 means Wi-Fi network interface.

Then we search for hosts we click on  ፧ (3 dot menu) > Hosts > Scan for hosts

It will scan all connected devices on our local network. Now we click on hosts list on the host menu and ettercap will show us connected devices in our same Wi-Fi network. The screenshot is following:

ettercap hosts list

Here in the above screenshot we can see our router's IP (the first one) and all other connected device. It doesn't included our Kali Linux device ettercap filtered it.

Now we add the router's IP on the Target 1 and all other IPs in the Target 2 by right clicking on the list.

Then we click on the  ፧ (3 dot menu) > Plugins > Manage plugins

plugins in ettercap

After this a new window opens like following screenshot:

plugin's list in ettercap

Here we find the plugin named "dns_spoof" and double click on it.

Then we click on the MITM (Man In The Middle) menu and choose ARP poisoning.

ARP poisining in ettercap

Then a popup box comes for optional parameters here we ✔️ on the Sniff remote connection box and click on OK.

Sniff remote connections
Here we click on OK to start MITM attack
Now we have all set. We now can open browser in our other device connected in same Wi-Fi network (in our case Android mobile) and type http://www.kali.onion in the address bar and we will open the page we have made and put in our Kali Linux's /var/www/html directory.

localhost with a domain name
Localhost website with a domain name
So this is how we can point a domain name to our localhost IP using Kali Linux system. This is the core concept of making the dark web. To host own dark web on the internet follow our Creating Own .onion Dark Web on Internet tutorial.

This tutorial has many practical uses. We can make a local website or download files over the WiFi. If we have good website building knowledge then we can even make a chatting website for our home or many other things.

If you liked our tutorial then follow us on Medium and Twitter for quick updates. Visit our website regularly to learn things about Kali Linux.
Kali Linux


Post a Comment
  • smiler kai photo
    smiler kaiJune 15, 2020 at 9:31 PM

    hi admin, I asked the marginal problem a bit, my old computer got stuck with a ransomeware version grandcrab v2.0, it encrypts all my data files, can I recover encrypted data? is not ? ?

    Delete Comment
    • Kali Linux photo
      Kali LinuxJune 16, 2020 at 2:23 AM

      Hello Smiler Kai,

      Sorry to hear your have been hit by GandCrab, unfortunately there is no known way to decrypt the files (other than paying the ransom which we don't recommend). Restoring from backups is the best option if you have them.

      Delete Comment
    • Palgaurav photo
      PalgauravAugust 24, 2020 at 4:31 PM

      hello sir i am having issue in etter.dns file in my file i can't find microsost sucks line

      Delete Comment
    • mastoom photo
      mastoomOctober 28, 2020 at 1:05 PM

      I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have you bookmarked your site to check out the new stuff you post. Lds in the news

      Delete Comment
      • abarie1 photo
        abarie1December 6, 2020 at 1:00 PM

        There are a few significant choices you'll have to make.Domain Appraisal

        Delete Comment
        • Anonymous photo
          AnonymousJune 19, 2021 at 7:19 PM

          Super site! I am Loving it!! Will return once more, Im taking your food likewise, Thanks. 2000 company names

          Delete Comment
          • sadasda photo
            sadasdaAugust 8, 2021 at 8:45 PM

            I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. Server

            Delete Comment
            • Liana photo
              LianaAugust 10, 2021 at 1:32 AM

              Thank you again for all the knowledge you distribute,Good post. I was very interested in the article, it's quite inspiring I should admit. I like visiting you site since I always come across interesting articles like this one.Great Job, I greatly appreciate that.Do Keep sharing! Regards,

              Delete Comment
              • AnonymousApril 11, 2023 at 8:29 PM


                Delete Comment