How do packets and routing tables forward data in the network? Learn in one minute

How do packets and routing tables forward data in the network? Learn in one minute

1. Routing Table

When the frame reaches the router's interface, the router checks the destination address in the frame. If the destination address is the router's interface address or the broadcast address, the router strips the packet from the frame and passes it to the Network Layer. The destination address in the packet is then checked, followed by the protocol field, and finally sent to the appropriate process. If the packet is routable, the router searches its own routing table for the corresponding routing entry.

1. Two important elements in the routing table:

  • Destination address, this address is the address that the router can reach,
  • The direction to the target address is called the next hop.

2. The router matches the address to the maximum extent during the address matching process, and the addresses are arranged in descending order of accuracy.

  • Host Address
  • Subnet
  • Summary address
  • Primary network number
  • Supernet
  • Default address

If the address cannot be matched with any entry in the routing table during the address matching process, the packet will be discarded.

[An ICMP message named Destination Unreachable will be sent back to the source address]

2. Static routing configuration

  • Determine the address for each link (including subnet address and network address)
  • For each router, identify the link address of the indirect link
  • Write out routing statements for each router that does not directly connect to the address (writing out statements for directly connected addresses is not necessary)

  1. Piglet(config)#ip route 192.168.1.0 255.255.255.224 192.168.1.193  
  2. Piglet(config)#ip route 192.168.1.64 255.255.255.224 192.168.1.193  
  3. Piglet(config)#ip route 10.4.6.0 255.255.255.0 192.168.1.193  
  4. Piglet(config)#ip route 10.4.7.0 255.255.255.0 192.168.1.193

Set a static route with a slightly larger management distance than the normal route. For example, set the management distance of a route to 50. When the normal link goes down, the backup link set as the floating route is enabled.

  1. Piglet(config)#ip route 10.4.7.0 255.255.255.0 192.168.1.193 50

Load balancing can be based on the destination address or on the so-called opportunistic destination address of each packet. This means that if there are two paths to the destination address, the first packet will reach the first destination device through the first link, the second packet will reach the second destination device through the second link, the third packet will reach the third destination device through the first link, and so on. When Cisco routers work in the default switching mode, Fast Switching mode, they use this type of load balancing.

4. How Fast Switching works:

When the router processes the first packet to be sent to the destination address, it first checks the routing table and selects the egress interface, then obtains the information that makes up the frame (such as the ARP table query) and encapsulates it before transmitting it. The previously obtained routing and data link information will be stored in the fast switching cache.

Next, when there is a packet that is destined for the same destination address as the first packet, the packet can be directly exchanged without querying the routing table and ARP table.

Fast switching reduces CPU usage and processing time, and means that packets destined for a certain destination are routed out of the same router interface. When there are packets destined for different hosts on the same network, the router may route these packets through another link.

Therefore, the best a router can do is to balance the load of the target address. Packet-based load balancing means that if there are two paths to the target address, the first packet will reach the target device through the first link, the second packet will reach the target device through the second link, the third packet will reach the target device through the first link, and so on (here we consider equivalent balanced load).

<<:  How much room do operators have for increasing speed and reducing fees?

>>:  Share a few DOS commands that are not outdated. Please save them if you need them.

Recommend

China will add more than 600,000 5G base stations by 2023

China is making significant progress in expanding...

A thorough investigation of the history behind Huawei's high-quality Wi-Fi ONTs

[51CTO.com original article] Only after careful c...

Why do big companies have API gateways? It’s not as simple as you think!

[[319983]] In this article, we will explore the r...

SPI Subsystem SPI Driver

1. SPI driver source file directory Linux common ...

A brief discussion on the 3PC protocol for distributed system consistency

This article is reproduced from the WeChat public...

...

Summary information: CUBECLOUD/zorocloud/Eurasia Cloud/Bluemi Cloud

Recently, we have received product promotion info...

Changes to the Internet in 2018

There are already many articles in the industry p...