The commands for networking with Kali OS is

ifconfig; route -n; cat /etc/resolv.conf; cat /etc/network/interfaces; cat /etc/hosts




  • ifconfig:

Displays various bits of information about the NIC (e.g. IP addresses, subnet, MAC address etc).

Note: ifconfig -a, will display information about ALL NICs

root@kali:~# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0b:29:9c:c9:b3  
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::20c:29ff:ff9b:c9a3/64 Scope:Link
          RX packets:292216 errors:0 dropped:0 overruns:0 frame:0
          TX packets:135628 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:431730275 (411.7 MiB)  TX bytes:7398306 (7.0 MiB)
          Interrupt:19 Base address:0x2000 

lo        Link encap:Local Loopback  
          inet addr:  Mask:
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:26 errors:0 dropped:0 overruns:0 frame:0
          TX packets:26 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1648 (1.6 KiB)  TX bytes:1648 (1.6 KiB)


You can also alter the state of the NIC by placing it in either 'down' or 'up' state, which disables or enables the NIC

root@kali ~$ ifconfig eth0 down
root@kali ~$ ping -c 1
ping: unknown host
root@kali ~$ ifconfig eth0 up
root@kali ~$ ping -c 1
PING ( 56(84) bytes of data.
64 bytes from ( icmp_req=1 ttl=128 time=18.0 ms

--- ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 18.061/18.061/18.061/0.000 ms
root@kali ~$


  • route -n

Displays the routing table i.e., gateways information.

root@kali:~# route -n
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface         UG    0      0        0 eth0   U     0      0        0 eth0


  • cat /etc/resolv.conf

Displays the DNS information

root@kali:~# cat /etc/resolv.conf
# Generated by NetworkManager
domain localdomain
search localdomain


  • cat /etc/network/interfaces

Displays the network interface configuration

Note: eth0 is set up to use DHCP.

root@kali:~# cat /etc/network/interfaces
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The loopback network interface
auto lo
iface lo inet loopback


  • cat /etc/hosts

Static values for hostname lookups

Note: Editing these values, will NOT change your hostname (for that look into hostname & /etc/hostname).

root@kali:~# cat /etc/hosts	localhost	kali-offsec

# The following lines are desirable for IPv6 capable hosts
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters


Was this answer helpful? 0 Users Found This Useful (0 Votes)