Analyzing and Managing Networks
33
get a new DHCP-assigned IP address. To do this,
you can always reboot your
system, but I’ll show you how to retrieve a new DHCP without having to shut
your system down and restart it.
To request an IP address from DHCP, simply call the DHCP server
with the command
dhclient
followed by the interface
you want the address
assigned to. Different Linux distributions use different DHCP clients, but
Kali is built on Debian, which uses
dhclient
. Therefore,
you can assign a
new address like this:
kali >
dhclient eth0
The
dhclient
command sends a
DHCPDISCOVER
request from the network
interface specified (here,
eth0
). It then receives an offer (
DHCPOFFER
) from the
DHCP server (192.168.181.131 in this case) and confirms the IP assignment
to the DHCP server with a dhcp request.
kali >
ifconfig
eth0Linkencap:EthernetHWaddr 00:0c:29:ba:82:0f
inet addr:192.168.181.131 Bcast:192.168.181.131 Mask:255.255.255.0
Depending on the configuration of the DHCP server,
the IP address
assigned in each case might be different.
Now when you enter
ifconfig
, you should see that the DHCP server has
assigned a new IP address, a new broadcast address, and new netmask to
your network interface
eth0
.