How to configure Kali Linux to use a static IP address

What are advantages of a static IP address usage?

On a local network, a static IP address allows you to use the Web server, SSH, FTP and other network services without having to get to know IP of a system on which these services are running each time. If you do not use these services, then there is no need to configure a static IP.

A static address for a particular computer or other device can be set in several ways:

  • in the settings of your router, bind the MAC address to the IP address: in different routers the configuration process may be slightly different, but usually these functions are located in the Local network (LAN settings) -> DHCP server -> The list of manually assigned IP addresses bypassing DHCP.
  • setting up a static IP address in Network Manager
  • setting up a static IP address in the command line

Manually assigning IP addresses bypassing DHCP in the router

The specific steps for binding the MAC address to the IP address in the router depend on the device model. Therefore, if you have any questions or you can not find the desired setting in your router, then refer to its manuals. In this case, the actions do not depend on the device to which you want to assign a permanent IP address, since all the configuration is performed in the router. Also, after resetting the settings on the device to which the permanent IP address was assigned (for example, when reinstalling the OS on the computer or Factory Reset of the phone), then the binding of the IP address to the device is preserved, since the MAC address is always unchanged.

This method is not suitable for virtual machines, even if a network connection of the Bridge type is used.

Configuring a Static IP Address in Network Manager in Kali Linux

In Linux, a static address in a graphical environment can be set in the Network Manager settings. To do this, click on the arrow in the upper right corner of the screen, in the menu that appears, click on ‘Wired Connected’, and then on ‘Wired Settings’:

A new window will open, in it click on the gear icon:

Another window will open, in which go to the IPv4 tab:

select ‘Manual’:

then enter the desired static IP in the ‘Addresses’ field, it should match your network, for example, if the router (default gateway) has the address, then the selected address should be 192.168.0.*, if the router has the address, then the selected IP should be of the form 192.168.1.* etc. Next, write down the ‘Netmask’, for most tasks is suitable, also write the ‘Gateway’, which is the IP router, an example:

If you wish, you can also set the DNS server settings, but this is not mandatory.

When done, click the Apply button.

By the way, to get to know the gateway (the IP address of the router) run the command:

ip r

The following will be displayed:

default via dev eth0 proto dhcp metric 100 dev eth0 proto kernel scope link src metric 100

After the ‘default via’ line, the IP router will follow, in my case it is

To apply made changes enter:

sudo systemctl restart NetworkManager

Check your current local IP with the command:

ip a

Configuring a Static IP Address in the Kali Linux Command Line

If for some reason you do not use Network Manager (for example, if you use Linux without a desktop graphical environment), you can configure a static IP address on the command line.

To do this, open the /etc/network/interfaces file with any text editor:

sudo vim /etc/network/interfaces

Only four lines should be added to this file. Example strings:

auto eth0
iface eth0 inet static

Let us examine them in more detail. eth0 is the name of the network interface. If there is only one network card, then in Debian (i.e., in Kali Linux too), this interface is called eth0. The second network interface is named eth1, etc.

If you are not sure, you can find the name of the wired network interface with the command:

ip a

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

Further in the third line, is the IP that we want our system to always have. And /24 is an alternative way to set netmask. These characters correspond to

As you might guess, in the last, fourth line, means a gateway.

All these data need to be changed to fit your needs.

For the changes to take effect, issue the command:

sudo systemctl restart networking.service

Let's check:

ip a

As you can see, the interface is really assigned the required IP and now it will be saved after each reboot.

However, there is currently no Internet connection, because we have not configured DNS. These settings are made in the /etc/resolv.conf file. If you already have Network Manager installed, then instead of /etc/resolv.conf there is a link to /run/NetworkManager/resolv.conf

sudo rm /etc/resolv.conf

Open /etc/resolv.conf with any text editor:

sudo vim /etc/resolv.conf

and add the line:


Finally, now you can check:


On Kali Linux, the made changes do not disappear after the download. If they disappear, the file /etc/resolv.conf can be protected from writing:

sudo chattr +i /etc/resolv.conf

Last Updated on

Recommended for you:

3 Comments to How to configure Kali Linux to use a static IP address

  1. Tom says:

    Perfectly working for me !

  2. Miguel says:

    Thank you so much, I wasted hours and hours of sweat and tears trying to understand hindi tutorials, but I now finally understand. 


  3. Akhil says:

    Internet is not working

Leave a Reply

Your email address will not be published.