How to Configure Static IP address in Kali Linux

Configure static IP address

In this article, you will learn to configure a 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 Manually

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 configuring 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 a 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 reflected 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.

Configure static IP address | How to Configure static IP address | What is the Configure static IP address | why do we Configure static IP address | Manually configuration of static IP address | Manually configuration of a static IP address in Kali Linux | Manually configuration of a static IP address in Linux | Best way to configure static IP address | Good practice for IP configuration in Linux |

If you are facing any problem during the IP address configuration manually then you can share the error and screenshot of that error. We are going to help you to fix that problem for you. Also, if you want any help for Kali Linux or any other distro of Linux type the message in the comment section.

Leave a Reply