The role of the path table
The router provides a mechanism for interconnecting heterogeneous networks to send a data packet from one network to another, and routing is to guide the sending of IP data packets The path information.
The router selects an appropriate path (via a certain network) according to the destination address of the received data packet header, and transmits the data packet to the next router. The last router on the path is responsible for sending the data packet Hand over to the destination host.
When the data packet is transmitted on the network, each router is only responsible for forwarding the data packet of its own site through the optimal path, and the data packet is passed through the optimal path through the relay of multiple routers. Forward to the destination. Of course, sometimes due to the implementation of some routing strategies, the path through which the data packet passes is not necessarily the best path.
The path table stores the paths discovered by various routing protocols, and records the routing information of all network segments known by the router. Routers usually look up the path table to determine the forwarding path based on the destination network segment address of the IP data packet.
Path table information
The routing table usually contains the following information:
Dest: Destination logical network or subnet address.
Mask: The mask of the destination logical network or subnet.
Gw: The port address of the adjacent router, that is, the next hop IP address of the route.
Interface: The interface that learned the route entry is also the interface through which the data packet leaves the router to the destination.
Owner: The source of the route, indicating how the route information is learned.
Pri: The administrative distance of the route, namely the priority, determines the priority of the routing information from different routing sources.
Metric: Metric, which represents the cost of each possible route. The route with the smallest metric is the best route. Metric is only comparable when the same dynamic routing protocol finds multiple routes to the same destination network segment. The metrics of different routing protocols are not comparable.
For example, a piece of routing information of 10.26.33.253 in the above routing table, where:
10.26.33.253 is the destination logic Network address or subnet address, 255.255.255.255 is the network mask of the destination logical network or subnet.
10.26.245.5 is the logical address of the next hop.
gei-1/1 is the interface that learned this route and the interface that will forward the data.
OSPF is the way the router learns this route. In this example, this route information is learned through OSPF.
110 is the administrative distance of this route, and 14 is the metric value of this route.
Route source (Owner) indicates how the routing information is learned.
In the routing table, Owner is Address, which means that the routing source is the local address.
The route generated by the network segment directly connected to the router is discovered by the link layer protocol. The direct route can only discover the network segment to which the interface belongs.
When the interface is configured with a network protocol address, the status is normal (that is, the physical connection is normal), and the keepalive information of the data link layer protocol can be detected normally, the network segment address configured on the interface automatically appears in the routing In the table and associated with the interface; when the router detects that this interface is down, this route will automatically disappear from the routing table.
The direct route generation method Owner is Direct, the route priority is 0, and it has the highest route priority. Its metric value is 0, which means it has the smallest metric value.
The routing manually set by the system administrator is called static routing, which is generally pre-set according to the network configuration when the system is installed. Will automatically change with changes in the network topology in the future. Whether a static route appears in the routing table depends on whether the next hop is reachable, that is, whether the network segment where the next hop address of this route is located is reachable to the router.
Static routing is generated in Owner as Static, routing priority is 1, and its Metric value is 0.
In dynamic routing, administrators no longer need to manually maintain the routing table on the router like static routing, but run one on each router Routing protocol. This routing protocol generates routing table entries in the routing table according to the configuration of the interface on the router (such as the configuration of the IP address) and the state of the connected link.
The dynamic routing protocol generates and maintains the routing table required by the forwarding engine through the exchange of routing information. When the network topology changes, the dynamic routing protocol can automatically update the routing table and is responsible for determining the best path for data transmission. Common dynamic routing protocols include RIP, OSPF, IS-IS, BGP, etc.
The default route is a routing table entry used to indicate how data units that are not explicitly listed in the routing table at the next hop should be forwarded. All data packets that cannot find a clear routing entry in the routing table will be forwarded according to the interface and next hop address specified by the default route.
The default route is also a special static route, with the destination address and mask configured as all zeros (0.0.0.0 0.0.0.0). The default route generation mode is Owner as Static, the route priority is 1, and its Metric value is 0.
As to the same destination, different routing protocols may find different paths, but not all of these paths are optimal. In fact, at a certain moment, the current route to a certain destination can only be determined by a single routing protocol.
Therefore, in order to identify the optimal path, each routing protocol (including static routing) is given an administrative distance. In this way, when there are multiple routing information sources, the route discovered by the routing protocol with a smaller administrative distance value will become the optimal route and be added to the routing table.
If there are multiple routes with the same destination network segment, the IP packet will preferentially select the route with the highest priority (that is, the smallest administrative distance value) for forwarding.
Management distance values corresponding to different routing protocols:
Route Source< /b>
Static route out an interface
Static route to a next hop
|< p>RIP v1, v2|
route metric value (Metric) identifies what the route refers to The cost of the destination address is usually affected by factors such as the number of hops, bandwidth, line delay, load, line reliability, and maximum transmission unit.
Different dynamic routing protocols will choose one or more of these factors to calculate the metric value (for example, RIP uses the number of hops to calculate the metric value). The metric value is only meaningful within the same routing protocol. The routing metric values between different routing protocols are not comparable, and there is no conversion relationship.
The metric value of static routes and direct routes is 0.
Common path characteristics used for metric calculation:
Hop count: The number of routers that a data packet must pass through to reach its destination; the fewer the hops, the more the route will be Excellent; the path is often described by the number of hops to reach the destination.
Bandwidth: The ability of a link to transmit data.
Delay: The time required to send a data packet from the source address to the destination address.
Load: network resources (such as routers) and the amount of activity on the link.
Reliability: Refers to the error rate on each network link.
Maximum transmission unit (MTU): refers to the largest data unit that the port can transmit.
Choose one or more of the above for each routing protocol to calculate the metric value.
Route matching principle
In routers, the basis of route selection includes destination address, longest match, management distance (Priority) and metric value (Metric).
The default route selection process is as follows:
1. Search based on the destination address and the longest match principle.
2. If there are two or more routes that match, check the administrative distance. Different routing protocols have different administrative distance values. The smaller the administrative distance value, the higher the priority.
3. When the management distance is the same, the measurement value is viewed. The smaller the metric, the higher the priority.
The longest match of a route is to use the route with the longest subnet mask in the routing table to reach the same destination during route lookup.