Packet forwarding is the process of directing the packet towards its destination. As we know that Internet is a combination of several networks. A packet may belong to the same network as of source host or it may be for the destination host in a different network. So, a packet from a source host may have to travel many networks before reaching the destination.
Packet forwarding is the responsibility of the router where the router has to accept the packet from the source host or a router in the path of the packet and place it on the route heading towards the destination host.
- Forwarding Based on Destination Address
- Forwarding Based on Label
Forwarding Based on Destination Address
Packet forwarding based on the destination address requires the source host and routers in the path of the packet to have the routing table. Whenever the host is ready with the packet to be sent or the router receives a packet to forward it to the next router or the destination host, they look up the routing table to decide the route of the packet toward the destination host.
But nowadays Internet has grown too far, so many entries in routing make the table lookup inefficient. There are several techniques to minimize the size of the routing table and also manage the security of the routing table.
1. Next-Hop Method
The next-hop method minimizes the size of the routing table by just keeping the details of the next hop or next router in the path of the packet. Here the routing table does not involve the information about the entire route the packet has to follow.
2. Network-Specific Method
Here the routing table does not have an entry for all the destination hosts in the network connected to the router. Instead, it has an entry of the destination networks itself connected to the router.
3. Host-Specific Method
It is the reverse of the network-specific method. Here the routing table has an entry for all the destination hosts in the destination network. It reduces the efficiency of the routing table as the size of the routing table is increased. It is usually used for checking the routes and for security purposes.
4. Default Method
Consider the situation that a host in a network N1 is connected to two routers where one router R1 is connected to the network N2 and another router R2 connects it to the rest of the internet. So here the routing table has only one entry for the router R2 as a default entry.
Packet Forwarding Process
1. Forwarding with Classful Addressing
In classful addressing the entire address, space is divided into classes we have studied this in our previous content classful addressing. The classful addressing has a default mask which makes the packet forwarding easier. We will see packet forwarding in classful addresses with and without subnetting.
a. Forwarding without Subnetting
Routers on the global Internet using classful addressing do not perform subnetting. Usually, subnetting is performed inside an organization. Packet forwarding module where subnetting is not involved includes three tables where each table represents a unicast class (A, B, C).
If the routers of the global internet support multicasting a new table is added to handle the class D address. With the different routing tables for each class searching the routing table for next-hop becomes easier. Let us see the structure of the routing table.
In the points below we will discuss the columns of the routing table:
- The first column is the network address which defines the address of the network to which the destination host belongs.
- The second column is of next-hop which specifies the address of the next router in the path of the packet if it is an indirect delivery. In case it is the direct delivery the next-hop column is empty.
- The third column specifies the interface number. The router has many outgoing ports, where each outgoing port connects the router to a different port. Each connection has a different numbered port which we refer to as interface number.
The following steps describe the forwarding module that is used to forward packets in the classful addressing where subnetting is not involved.
- From the packets header, the destination address is determined.
- The destination address is used to determine the class of the address.
- After identifying the class of the address, the destination address and class are combinedly used to extract the network address.
- Now the class of the destination address is used to decide which table among the three must be referred and the network address extracted is used to determine the next-hop and interface number.
- The next-hop (logical address of next router) and interface number are provided to ARP to determine the physical address of the next router.
b. Forwarding with Subnetting
Subnetting always happens inside the organization and the routers handling the subnetting are either at the boundary of the organization or just inside the border of the organization.
If the variable length subnetting is used then several routing tables will be used else only one routing table will do the work. For the fixed-length subnetting the following steps are used to forward the packet.
- First, the destination address is extracted from the packet’s header.
- If the extracted destination address goes with any of the host addresses in the table, then the destination address and the mask are used together to determine the subnet address.
- Using subnet address as index the next-hop and interface number are determined.
- The next-hop address and the interface number are provided to the ARP protocol to determine the physical address of the next hop.
2. Forwarding with Classless Addressing
In the classless addressing, there is no division of address space into the classes. We have studied classless addressing, in our previous content classless addressing So, the address of the destination does not provide any information about the destination network. To overcome this issue, we require masking.
So, the routing table of in-classless addressing requires one more column as compared to classful addressing i.e., mask column.
a. Address Aggregation
Address Aggregation is similar to subnetting. A set of addresses or a block of addresses are summarized in the routing entries to minimize the size of the routing table.
b. Longest Mask Matching
The longest mask matching helps the IP router to select an entry from the routing table. An entry in the routing table may specify a subnetwork. In this case, a destination address may do with more entries. Among these entries, the entry with the longest subnet mask is the most specific one. An this is called longest mask matching.
c. Hierarchical Routing
To reduce the size of the routing table, a hierarchy can be implemented in the routing table. Hierarchical routing is achieved by organizing routers in some hierarchy. This reduces the complexity of the network and even increases the routing efficiency.
d. Geographical Routing
To further minimize the size of the routing table, above hierarchical routing, geographical routing must be practiced. The geographical routing divides the entire space in the world into few large blocks. For example, we divide the space into blocks such as America, Africa, Asia, Europe, and so on.
Forwarding Based on Label
To send IP packets in a connection-oriented fashion the routing was replaced by the switching. We had studied the switching process in our earlier content IP Over ATM.
In routing, the destination address present in the header of the packet is used to forward the packet. In the switching process, the switch forwards the packet by analyzing the label attached to it. The label contains the identifiers that define which specific virtual path and virtual circuit the packet has to follow.
1. Multiprotocol Label Switching
During 1980 most of the vendors were launching the routers with switching technology. Considering this a new protocol was approved which is multi-protocol label switching (MPLS). This packet forwarding technology uses the label to forward the packet.
The MPLS protocol can convert the routing network to an appropriate switching network. So, when required the MPLS router can forward the packet using the destination address and when required it can forward the packet based on the label attached to it.
2. Hierarchical Switching
A packet can have stacks of labels for this the MPLS protocol allows hierarchical switching which is similar to hierarchical routing. The top label of the packet is used to route the packet outside the enterprise and the bottom label is used to route the packet inside the enterprise to reach the destination subnet.
So this is all about packet forwarding, we have seen how this is done using a destination address or a label attached to the packet.