Now that we know how IP addresses are assigned and how switches and routers work, let's observe how two hosts communicate with each other on a local network.
The following steps show a simplified Transmission Control Protocol (TCP)/Internet Protocol (IP) transaction to get an IP address.
- Open the Web Browser and Enter the IP Address for the Development Board
- PC Generates and Transmits a Frame
- Frame is Forwarded Through the Switch
- Frame Arrives at the Development Board and is Forwarded to the Web Server
- Web Server Sends the Webpage to the PC
Assume we have an embedded network device we want to control and monitor. One way we could do this is to create a web page on the embedded device that displays the status of the embedded device. This web page could also be used to control the device.
1 Open the Web Browser and Enter the IP Address for the Development Board
We will use a web browser on the PC to access a web page on the development board.
Note that both the PC and development board in this example currently have an IP address. This also means the switch has seen a frame sent from each node, so the switch’s routing table has been updated to show which MAC address is connected to each port.
We open a web browser on the PC and enter the IP address for the development board.
2 PC Generates and Transmits a Frame
The PC creates a frame of data then sends it to the PHY to transmit on the local network.
This frame was initiated by the web browser when it created a message requesting to download the web page found at IP address 192.168.1.102
The source and destination IP addresses were added to the message to create a packet, then the source and destination MAC addresses were added to the packet to create the frame.
This step has been simplified. It does not show the Transport Layer (TCP). It also doesn’t show the Address Resolution Protocol (ARP) process of obtaining the destination MAC address.
3 Frame is Forwarded Through the Switch
The frame arrives at the switch and it is opened to find the destination MAC address. This MAC address is found in the routing table so it sends it out to Port 0.
Note that the switch only opens the frame to determine the MAC address. A switch is a layer 2 device and is only concerned with layer 2 (MAC) addresses. It doesn’t touch the packet or care what the IP address is.
4 Frame Arrives at the Development Board and is Forwarded to the Web Server
The frame arrives at the development board and the message is delivered to the web server application. Let’s look at this process in more detail:
When the frame arrives at the development board, the destination MAC address is checked to determine if it needs to pay attention to the frame. The MAC address matches its own, so it opens the frame to check the destination IP address in the packet. The development board finds the destination IP address matches its own and opens the packet to see what the message is. The development board finds that the message is for a web server. The board happens to have a web server running on it, so it sends the message to the web server application.
- If the MAC address in the frame doesn’t match the device’s MAC address, the frame will be discarded by the Data Link Layer (Layer 2).
- If the IP address in the packet doesn’t match the device’s IP address, the packet will be discarded by the Network Layer (Layer 3).
- If a message is sent to an application (port number) that is not running in the device it will be discarded by the Transport Layer (Layer 4).
5 Web Server Sends the Webpage to the PC
Now it’s time for the development board to send the web page. The development board generates a message containing the web page then sends the frame to the PC. Let’s look at this process in more detail:
The web server running on the development board generates a message containing the web page. The board then adds the source and destination IP addresses to create a packet and adds the source and destination MAC addresses, creating a frame. This frame is then sent to the PHY for transmission on the local network.
Question:
What happens next?
Answer:
- The frame is received at the switch.
- The switch finds the frame’s destination MAC address and uses its routing table to determine what port to forward the frame to.
- The frame is sent to the PC
- The PC opens the frame and checks the destination MAC address to determine if it needs to pay attention to it.
- The PC opens the packet and checks the destination IP address.
- The PC opens the message and finds the web page (which is just an HTML file) it requested.