Learn the Packet Delivery Process (Default Gateway and ARP) - Pt. 1
For everyday network communications and using various business and entertainment applications, a vast amount of data packets is exchanged between networking devices. However, the host-to-host delivery either in the same network or between different networks is not a simple process and several protocols and many steps are involved.
Firstly, each device that wants to participate in the network must have a unique IP address assigned. One part of the IP address identifies the network where the host belongs, while the other part identifies the host itself.
With this information, the hosts always know if they communicate internally inside the same network, or if they belong to different networks. However, knowing the IP address of the destination is not enough for proper communication.
The sender must also know the Media Access Control (MAC) address of the receiver to be able to send the data. Therefore, a protocol that maps the IP address and the MAC address of the destination host must be used.
On the other side, for communication inside the same network, using a switch is enough for exchanging data packets between hosts. When there is communication between different networks, a Layer 3 device (such as a router) must be used so packets are routed between the networks.
However, before packets reach the routers, the hosts must send them first, and that is the tricky part of the process. Hosts are not capable of routing, so they cannot send packets unless they are destined for hosts in the same network. For that reason, they must use a default gateway to send data to receivers that belong to different networks.
In this Part 1 of 2 series, we provide an overview of the default gateway and its purpose in networks, as well as the Address Resolution Protocol (ARP) required for learning the MAC addresses of the destination devices.
Let PivIT handle your router setups with EXTEND, our professional services team, that can serve as a seamless and confidential extension of your IT teams. Consider us your boots on the ground working to cost-effectively extend your reach and complete your projects on time and within your budget.
Default Gateway Overview
Before we discuss the default gateway and its purpose in networks, we must first cover the meaning of the MAC and IP addresses. Each networking device has a MAC address that uniquely identifies it.
However, these Layer 2 addresses have no meaning outside the local network media and are used to locate the end devices only in the local physical network. Conversely, Layer 3 devices are assigned to devices such as computers, L3 switches, routers, and firewalls among others, that provide Layer 3 operations.
For proper network functioning, each device must use a unique IP address inside the same network, so no duplicate issues could ever occur.
So, why do end devices need to use a default gateway? Well, a device can only communicate directly with a destination host if they both belong to the same network.
However, if they belong to different networks, the only way for packets to be delivered to the destination host is by sending them to the default gateway first, which is usually a router, and then forwarded to the destination.
As you will see in the image above, both computers are part of the same network (192.168.1.0/24). This allows them to communicate with each other only with the help of the switch through which they connect to the network.
However, if any of these two hosts want to send traffic to the webserver on the internet, they must know how to get there. Since they are not capable of routing, the only available option is to use a default gateway.
This device, in this case, a router (R1), belongs to the same network as the hosts in need of the default gateway, but supports routing and knows how to forward the data to the destination IP. Therefore, hosts send the data to the default gateway first, and then the router forwards it to the webserver on the internet.
If you require a switch for your network, but you are not sure which is best, view some of the following posts:
- Comparing the Cisco 3560, 3850, and 9300 Switches
- Comparing Market Leaders: Cisco and Arista Switches
- Deep Dive Comparison: Cisco's Catalyst 6500 & 6800 Switches
- Head-To-Head With the Cisco Catalyst 4500 vs. 9400 Chassis Switches
Utilizing the Address Resolution Protocol (ARP)
When a device sends data to a remote device, both the IP and the MAC address of the destination host is needed on the sending device. The reason for this requirement is that the sender encapsulates the packet into a frame, so both are part of the encapsulation process (i.e., the IP address in the packet and the MAC address in the frame).
Many people make the mistake of only adding an IP address to send data, when both the IP and MAC address are needed. By way of example, when you ping a host, you define only the IP address of that host, but the MAC address of the destination is also included in the encapsulation process for the ping packet to be sent.
So, how can a device learn the MAC address of the destination host? Simply by using the Address Resolution Protocol.
The main purpose of this Layer 2 protocol is to map the IP address of a remote device to its MAC address. The way it works is quite simple and three steps are involved in the process.
Step 1 - Sending an ARP Request
When the sender needs to find the MAC address of the remote device, ARP sends a special type of message called an ARP request. This ARP request is a broadcast message and contains a request inside it.
Step 2 - Sending an ARP Reply
The request instructs the device with a specific IP address to reply to the sender IP with information about its own MAC address or the MAC address in question. This reply message is called an "ARP reply" and contains the mapping of the destination hosts’ MAC and IP addresses.
Step 3 - Storing the Information in an ARP Table
Once the information is dynamically learned, it is stored in the ARP table of the device and stays there until the timeout expires. On Cisco devices, the timeout is 4 hours by default (although it can be changed) while other operating systems might have a different value.
If no device responds to an ARP request, the original packet is dropped because a frame cannot be created without the missing MAC address of the destination device.
A Practical Example of Steps 1 to 3
Get help choosing the best router for your network by speaking with our specialists.
As you can see from the image above, the host on the left wants to print something. However, it does not have any information about the printer’s MAC address. An ARP request message is sent, which is received by any device in the local network, including the printer.
Because the printer recognizes its IP address in the ARP request message, it replies with an ARP reply message that contains the mapping of its IP and MAC addresses. Upon receipt, both parameters are included in the ARP table of the host and the encapsulation process starts.
Now that the host has the missing parameter, it can create a Layer 2 frame and forward the data toward the printer. Keep in mind that the printer is not always in the same network as the host. In such a case, the host needs to use a default gateway to send data to the printer.
One Step Closer to Understanding the Packet Delivery Process
Understanding the basics behind the IP and MAC addresses, the default gateway, as well as the ARP protocol, is critical for proper network implementation and providing everyday services within your network. This helps you better understand the delivery process of the data and easily troubleshoot the network when problems arise.
Now that you are familiar with all these concepts, let’s dive into the packet delivery process for host-to-host communications in Part 2 of this series.
Don't let unreasonable lead times stop you from getting the routers you need. PivIT gives you the freedom to choose from an extensive network of OEM partnerships, maximize your budget, and create a strategy to keep your network scalable.