Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How does the router forward packets

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

This article is about how routers forward packets. The editor thought it was very practical, so I shared it with you as a reference. Let's follow the editor and have a look.

First consider the question of how routers are addressed. There may be two ways, one is like Amap, after entering the starting point and the end point, several complete routes from the starting point to the end point will come out. The other is similar to a road sign, which does not indicate the complete route, but will tell you where the next destination is at different junctions.

The router uses the second way, because the first is not in line with the actual situation. The network is so complex that it is impossible for a router to know the topology of all the networks. Even if it does save the routes of all networks, it is extremely inefficient and takes up a lot of storage, and querying routes will become extremely inefficient.

So the router will only keep the information about the network connected to it, so that when a packet passes through a router, the router will choose the address of the next hop according to the destination address to deliver the packet, which may be forwarded by more than a dozen routers before a packet is finally delivered to the destination host.

Routers have their own algorithms for forwarding packets. Let's take a look at how routers forward packets:

(1) first, the destination address is extracted from the packet.

(2) to see if it can be delivered directly. That is, whether the network where the destination address is located is directly connected to the router, if connected, it can be delivered directly, and does not need to be forwarded by other routers. Otherwise, execute 3.

(3) check whether the routing table has a specific host route, and if so, forward it to the next hop address specified by the specific host route, otherwise execute 4.

(4) check to see if there is a general route that matches, and if so, forward it according to the next-hop address specified by the general route that conforms to the rule, otherwise execute 5.

(5) if a default route is set in the routing table of the router, the packet is forwarded to the address specified by the default route, otherwise execute 6

(6) discard the packet and report a forwarding failure

Thank you for reading! About how the router forwards packets is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge. If you think the article is good, you can share it and let more people see it.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report