UDP Ports
Figure 18.3 shows the interaction between a client and a DHCP server. The server uses
the well-known port 67, which is normal. The client uses the well-known port 68,
which is unusual. The reason for choosing the well-known port 68 instead of an ephemeral
port is to prevent a problem when the reply, from the server to the client, is broadcast.
To understand the problem, let us look at a situation where an ephemeral port is
used. Suppose host A on a network is using a DHCP client on ephemeral port 2017
(randomly chosen). Host B, on the same network, is using a DAYTIME client on
ephemeral port 2017 (accidentally the same). Now the DHCP server sends a broadcast
reply message with the destination port number 2017 and broadcast IP address
FFFFFFFF16. Every host needs to open a packet carrying this destination IP address.
Host A finds a message from an application program on ephemeral port 2017. A correct
message is delivered to the DHCP client. An incorrect message is delivered to the
DAYTIME client. The confusion is due to the demultiplexing of packets based on the
socket address (see Chapter 17), which is a combination of IP address and port number.
In this case, both are the same.