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

Posted by
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.

First, we start our Apache2 service by using the 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 address 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 the 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 the 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 the 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 another device by entering the IP and file name as shown in the following screenshot:

localhost files in mobile device

So we have created our localhost website and it can be accessed 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 the 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 the 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 the following screenshot:

etter.dns file opening

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

etter.dns file configuring big
Add a line above the

Then add a line just above the line. The line will be the 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 the 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. Hereby 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 devices. It doesn’t include 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 the 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 the 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.

Feel free to leave a comment below or reach me on Instagram @iamshubhamkumar__.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.