Before communicating with a device over a local network, we need to join the network. The router creates a local network and controls access to it. It has the job of allocating and assigning the IP addresses used on its local network. When a device connects to a network, it will automatically request an IP address from the router.
The following steps show a simplified TCP/IP transaction to get an IP address.
- PC Generates Request for IP Address
- IP Address Request Received in Router
- Router offers an IP address to the PC
- PC receives IP address from router
- PC configures its IP address
1 PC Generates Request for IP Address
Note the PC’s IP Address is 0.0.0.0 before it is assigned. Also note the PC and the router are physically connected together with an Ethernet cable. The end of every Ethernet cable or WIFI antenna is connected to a network PHY. This PHY is a transceiver responsible for generating and driving the signals that propagate on the wire. It will also receive and decode signals generated by the PHY at the other end of the connection.
The MAC address has been intentionally left out of this slide to simplify it. We will discuss level 2 (MAC) addressing when switches are introduced.
The broadcast IP address is 255.255.255.255.
Dynamic Host Configuration Protocol (DHCP) is the specific application used to request and grant IP addresses.
2 IP Address Request Received in Router
The router receives the packet and finds it has been sent to everyone on the network. It therefore has to pay attention to the packet. The router sees the sender of the packet needs an IP address assigned to it. That’s the router's job, so it creates a new IP address for it. All other hosts on the local network will eventually discard the packet once they discover the content of the message and realize they cannot provide an IP address.
3 Router offers an IP address to the PC
The router allocates a new IP address for the PC and generates a broadcast message containing this IP address.
Why does the router use the broadcast IP address instead of sending it directly to the PC’s IP address?
It can’t send it to the PC because the PC doesn’t know its IP address yet and therefore doesn’t have the ability to filter packets based on its IP address.
As a side note, this frame sent by the router will include the destination MAC address of the PC. The IP address is a broadcast address, but the frame also includes the specific destination MAC address of the PC. A switch will use the MAC address to forward this frame to the PC only.
The MAC address is the physical address of a network node. This will be covered in more detail when we describe how a switch works.
4 PC receives IP address from router
The PC receives a packet that has been broadcast to everyone on the network. It opens the packet and finds it contains a message for someone requesting to have an IP address assigned to it. This is the message it’s been waiting for!!
5 PC configures its IP address
The PC uses the IP address contained in the message to configure its network interface. It is now able to communicate on the network with it.