On the DHCP server, we could use commands such as, show ip dhcp binding
to see the client ID that's associated with an IP address.
So this IP address is being allocated
to this client ID here and it was allocated automatically.
Now that client ID isn’t very easy to read.
So what I’ll do is go into the interface on the client
and shut that down, in this example a DHCP release message was sent
to the DHCP server before the interface was shut down.
So when we look at the binding on the DHCP server, no binding now exist.
So ip dhcp client and we'll specify a client-id in ascii
and you'll simply set it to PC 2 and hit enter
and then use the command no shut to bring the interface up.
So we see a discover message, there’s an offer request from the client
and an acknowledgement from the server.
show dhcp lease what we can see here is the client ID is set to PC 2
and this is the client ID hexadecimal dump.
On the server show ip dhcp binding notice the user name is the same as on the client.
This can be converted from hexadecimal to ASCII and you’ll get PC 2.
As an example, the hexadecimal value 50 is the decimal value 80
and equates to capital P
in the same way hexadecimal 43 is capital C and hexadecimal 32 is value 2.
So this equates to PC 2 which can also be seen on the server.
So I wanted to shut that interface down, and show you Wireshark.
So I'll shut it down, I’ll start a Wireshark capture.
On the server router 2 and on router 1
I'll no shut the interface and let’s see if we get some DHCP messages.
So firstly, here's a DHCP discover message.
Bootstrap protocol discover, so DHCP discover
source port is UDP port 68, destination port is UDP port 67
it’s a boot request or DHCP request
notice the client MAC address is A,B,C as configured, the client IP address is 0.
The PC doesn’t know what IP address to use
and it doesn’t know about any DHCP servers. so it sending a message
to the broadcast address 255.255.255.255 so you can see it’s a discover.
There's other information here including the host name
of the device making the request, as well as a client identifier.
Scrolling down a bit further, we can see the offer from the DHCP server.
So this is from the server to a broadcast address
because the client doesn’t have an IP address, it needs to be a broadcast.
So it's a DHCP offer, offering this IP address to a client with this MAC address.
We can see information such as, once again it’s an offer
client identifier, so that's the server IP address
lease time is 7 days because we configure that manually.
We can see the subnet mask being /24, we can see option 3
default gateway, we can see option 6, DNS server
and we can see option 150 TFTP server.
The client then request that address
the clients still doesn’t have an IP address
so it sends it from a source IP address of 0.0.0.0 to a broadcast
and it's asking the server through the request
if it can have this IP address that was previously offered 10.1.1.14
the server then acknowledges, that the client can have that address
notice it's still a broadcast
so the server is telling the client that, yes they can use this IP address.
so the client, with this Mac address once again
has now being drawn to the right to use that IP address 10.1.1.14
so the client can now start using this address
and we can see that on the client, that it was assigned this IP address.