How to set static IP in kali linux?

0xLeeBai
1 min readMay 8, 2024

--

Step 1: Run as root user

┌──(kali㉿kali)-[~]
└─# sudo su

┌──(root㉿kali)-[~]
└─#

Step 2: Check your current IP configuration

┌──(root㉿kali)-[~]
└─# ifconfig

eth0 inet6 fe80::250:xxxx:xxxx:xxxx ... ... ...

Step 3: Change eth0’s IP address

┌──(root㉿kali)-[~]
└─# ifconfig eth0 10.10.10.2

┌──(root㉿kali)-[~]
└─# ifconfig

eth0 inet 10.10.10.2 netmask 255.0.0.0 broadcast 10.255.255.255

OR

┌──(root㉿kali)-[~]
└─# ifconfig eth0 10.10.10.2 netmask 255.255.255.0 up

┌──(root㉿kali)-[~]
└─# ifconfig

eth0 inet 10.10.10.2 netmask 255.255.255.0 broadcast 10.255.255.255

Step 4: if you need to assign a default gateway

┌──(root㉿kali)-[~]
└─# route add default gw 10.123.123.1

┌──(root㉿kali)-[~]
└─# ifconfig

eth0 inet 10.10.10.2 netmask 255.255.255.0 broadcast 10.255.255.255

┌──(root㉿kali)-[~]
└─# route

Destination Gateway Genmask Flags ... IFace
default 10.123.123.1 ... ... ... eth0

Step 5: if you need to add a DNS server

┌──(root㉿kali)-[~]
└─# nano /etc/resolv.conf

┌──(root㉿kali)-[~]
└─# cat /etc/resolv.conf

# Generated by NetworkManager
search localdomain
nameserver 8.8.8.8

Step 6: Test Ping with your target IP address

┌──(root㉿kali)-[~]
└─# ping 10.10.10.3

--

--

0xLeeBai

床前明月光,疑是地上霜。 举头望明月,低头思故乡。