[Computer Network] Routing matching principle

 

The role of the router:

After the router receives a packet, it will select an optimal route based on the destination IP address of the packet, and forwards the packet to the next router, the router on the path to the final will be responsible for data packets to the destination host.

So how to choose the best path, which will be related to the route selection.

Packet transmitted on the network as if it was in sports relay, each router is responsible for a next-hop router packet forwarding according to Zhong line the optimal path, the relay station by a plurality of routers in a station, forwards the packet to the final destination via the optimum path. Of course, sometimes due to the implementation of some special path routing policies, and data packets through may and must be the best. Router can determine the data packet forwarding path. If multiple paths to the destination, the router will be determined by calculating the optimal next hop. Routing protocols principle calculation with actual use will differ.

1 router will first routing table

Routing table contains the following key items:

Destination address (Destination): used to identify the IP packet's destination address or destination network.

Network mask (Mask): Network mask in the routing table also has important significance. IP address and the netmask "Logic" operator can obtain the corresponding information segment.

For example: the destination address is 8.0.0.0, the mask is 255.0.0.0, a logical segment information is not obtained after operation (8.0.0.0/8) an A class.

PS: the destination address and mask logic operation to determine the network segments not.

Logic operation:

8.0.0.0      --->00001000.0.0.0

255.0.0.0  --->11111111.0.0.0

Logic operation ---> 00001000.0.0.0 1 and 1 to be 1, the other are 0

Another effect is also reflected in the network mask when the same multiple routing table entry address routing information, the router chooses its longest match as a mask.

Protocol (Proto): that the use of the kind of routing protocol

Priority routing table (Pre), metric (cost) will be described hereinafter

Output interface (Interface): specify which interface IP packets forwarded from the router. Next hop IP address (NextHop): by the interface address of the next IP packet router specified trip.

2 is the longest match destination network objects

E.g. IP router receives the packet's destination is 10.1.1.1, the routing table, the routing table has two entries in the destination network segment 10.1.1.0, next-hop address is 20.1.1.2. If the file is forwarded to the network segment 10.1.1.1 To newspaper, the 10.1.1.0/30 in line with the longest match.

3 routing priority premise is the same network objects are different routing protocols

Each routing protocol has priority (The smaller the value, the higher the priority). When there are a plurality of routes, selects the highest priority route as the best route.

As illustrated, routers learn the route to network 10.1.1.0 by two routing protocols. Although RIP protocol provides a route look more directly connected, but because OSPF has a higher priority, and thus become preferred routes, and added to the routing table.

PS: there is the routing table is always the best route.

4 routing metric premise is the same network routing protocol overhead objects are different

 

If the router can not be a priority to determine the optimal route, use the metric (metric) to determine the need to add routes in the routing table.

Some commonly used measure are: hops, bandwidth, delay, costs, load, reliability and so on. It refers to the number of router hops to reach the destination passes. Bandwidth refers to the capacity of the link, a high-speed link cost (metric) is small.

The smaller metric value, the routing priority; therefore, illustration routing metric = 1 + 1 = 2 is the best route to a destination, which can be found entry in the routing table.

The router via the optimal path selected rule, then the data will be forwarded.



Reprinted link: https: //www.jianshu.com/p/658fd52a1ca9

 

Guess you like

Origin www.cnblogs.com/Skybiubiu/p/12609891.html