How to Configure Static IP address in Kali Linux

In this article, you will learn to configure static IP address in Kali Linux or other Debian Based Linux.

If you are using any Linux Distros, I suggest you prefer the command-line because it is simple and easy to follow besides clicking many times to find a single setting.

Here, I am going to tell you the method to configure the Static IP address using only the command line.

Configure Static IP address Manaually

So to open the configuration file, you can use any text editor. I am using vim the editor.

Firstly, type the below syntax. Use the sudo if you are a sudo user.

sudo vim /etc/network/interfaces

And press Enter Key

Secondly, you have to add four lines here. I am giving you the below example.

auto eth0
iface eth0 inet static

Save the file after changing it.

Configure Static IP address
Configuration of Static IP in Kali Linux

In the above example,

eth0 is the name of the network interface

If there is only one network card, then in Debian (including the Kali Linux), this interface is known as eth0. And The second network interface is named eth1, etc.

You can check your computer network interface using the below command

ip a

In the second line, you have to use the same interface name (eth0).

In the third line, is the IP that I want fo my system to always have. And /24 is an alternative way to set netmask. These characters correspond to

And in the fourth line, you have to put your gateway

Now to take effect of changes, you have to run the below command.

sudo systemctl restart NetworkManager

Configuring the DNS Manually

After configure the static IP address, you have to configure the DNS. So you can find this setting in /etc/resolv.conf

So to open the configuration file, you can use any text editor. I am using vim the editor.

sudo vim /etc/resolv.conf

but in case you are not able to find it here then you can use /run/NetworkManager/resolv.conf

sudo vim /run/NetworkManager/resolv.conf

If you find anything written already there then you can delete that and you can add the below google DNS.


And you can also add secondary DNS of Cloudflare,


Save this file after changes.

So now you can check your Internet connectivity. So you can use the ping command.


Note: If after changing the above information, the new IP is not reflecting then you can reboot the machine once. And check again.


In this tutorial, you learned to configure the IP address manually. But if you have any questions or any problems then you can write us in the comment box.

Also, maybe you can find the below article helpful.

Leave a Reply