• 2016.8.9
▫ 修正备注中的项目符号。
▫ 调整部分备注框大小。
▫ 调整部分表格中的文本对齐方式为中部对齐,文本框内对齐方式为顶部对齐。
▫ 命令行格式修正。
• As shown in the figure, RTA receives a packet destined for destination network N. RTA can forward this packet through multiple outbound interfaces. Which interface does RTA select to forward the packet? Actually, each router has routing information, which guides packet forwarding.
• As shown in the figure, RouterA is connected to the network at 10.3.1.0, and RouterC is connected to the network at 10.4.1.0. When a packet needs to be sent from 10.3.1.0 to 10.4.1.0, the IP routing process is as follows:
▫ The packet from the network at 10.3.1.0 is sent to E0 on RouterA, which is directly connected to the network at 10.3.1.0. When receiving the packet, RouterA searches the routing table and finds that the next hop is 10.1.2.2 and the
outbound interface is E1. Then the packet is sent to the next hop 10.1.2.2 from E1.
▫ When receiving the packet, RouterB searches its routing table and finds that the next hop is 10.2.1.2, and the outbound interface is E1. Then the packet is sent to the next hop 10.2.1.2 from E1.
▫ When receiving the packet, RouterC searches its routing table according to the destination address of the packet and finds that the destination is directly
connected to RouterC. The next hop is 10.4.1.1, and the outbound interface is E1.
Then the packet is sent to the destination address from E1.
• A routing table is key to packet forwarding. Each router saves a routing table in which each routing entry specifies parameters, such as the source, preference, cost, next hop, and outbound interface. The parameters specify the route through which packets are forwarded to the destination.
• If you run the display ip routing-table command on a router, the following routing table is displayed.
• Assume that the router receives a packet whose destination IP address is 9.1.2.1. The router searches the routing table and finds three matching entries:
▫ 0.0.0.0/0, with a mask of 0 bit.
▫ 9.0.0.0/8, with a mask of 8 bits.
▫ 9.0.0.0/16, with a mask of 16 bits.
• The RIP route with the destination/mask as 9.1.0.0/16 is matched based on the longest matching principle and the packet is forwarded through Ethernet0/0/1.
• As shown in the figure, 10.1.1.1/32 and 10.1.2.1/32 are routes discovered by the link layer. The Proto field is Direct.
• Static routes, manually configured by the administrator, are configured to connect networks. However, when a fault occurs on the network, static routes cannot automatically change and must be changed by the administrator.
• The Proto field of static routes is Static.
• When network topologies are complicated, static routes require a lot of configuration and errors probably occur. In this case, dynamic routing protocols can be adopted to automatically discover and update routes. These routes do not need to be manually maintained, but dynamic routing protocols are of high cost and complicated
configurations.
• As shown in the figure, the route whose Proto field is RIP is discovered by RIP, and the route whose Proto field is OSPF is discovered by OSPF. Dynamic routing protocols will be described in the following sections.
• Except for direct routes, the preferences of dynamic routing protocols can be manually configured as required. The preference is applicable to all the routes discovered by the same dynamic routing protocol. For example, all the routes discovered by the IS-IS protocol generally have a preference of 15. The preferences of static routes vary.
• As shown in the figure, there are two routes destined to the network segment 10.0.0.0:
R0 and R1. R0 is discovered by RIP and R1 is discovered by OSPF. By default, routes discovered by OSPF have higher preferences over those discovered by RIP, so the router selects the route discovered by OSPF and adds it to the global routing table to guide packet forwarding.
• As shown in the figure, there are two paths from Router A to Router D:
• A -> B -> C -> D, with a cost of 9
• A -> E -> F -> C -> D, with a cost of 12
• As shown in the figure, there are two paths from Router A to Router D:
• A -> B -> C -> D, with a cost of 18
• A -> C -> D, with a cost of 18
• There are three routes to 10.1.1.1, preference and cost are all the same, then this three routes will take effect in the same time, become equal-cost for load balance.
• After receive a packet, Router search routing table according to destination/mask, if there is only one item match, then forward the packet according to the next hop and out interface;
• If there are multi match,for example:
▫ Destination/Mask Proto Pre Cost NextHop Interface
▫ 10.0.0.0/24 OSPF 10 20 10.1.1.2 Ethernet0/0/1
▫ 10.0.0.0/24 RIP 100 20 10.1.2.2 Ethernet0/0/0
▫ Then select the route which has lower Pre value;
• If the Pre are also the same, then compare cost, for example:
▫ Destination/Mask Proto Pre Cost NextHop Interface
▫ 10.0.0.0/24 OSPF 10 20 10.1.1.2 Ethernet0/0/1
▫ 10.0.0.0/24 OSPF 10 30 10.1.2.2 Ethernet0/0/0
▫ Select the route which has lower cost value;
• If the cost are also the same, then do the load balance.
• In some situation, can configure preference.
• The command is as follow:
▫ [RTB] ip route-static 10.1.1.1 255.255.255.255 1.1.1.1 preference 90
▫ Configure two static routes with the same Destination, mask, preference, difference next hop, then they will work as load balance.
▫ Configure two static routes with the same Destination, mask, difference preference, difference next hop, then they will work as route backup.
• Two switches are connected by serial ports. You can configure a static route to the loopback network segment of Router A on Router B in the following modes:
▫ Express the mask in dotted decimal notation.
▫ Express the mask using the mask length.
▫ Replace gateway address with interface name.
• Static routes are applied in the following scenarios:
• Load balancing among static routes
▫ Static routes support load balancing. When there are multiple paths to the same destination with the same cost, IP packets are sent among the links.
• Floating static routes
▫ If there are multiple routes to the same destination, the route with the highest preference is selected as the primary route and other routes with lower
preferences are backup routes. Static routes support route backup.
• Default routes
▫ The default route is a special route. Generally, administrators can manually configure default routes. Default routes can also be generated through dynamic routing protocols such as OSPF and IS-IS.
▫ When a router receives a packet whose destination address cannot be found in the routing table, the packet is forwarded to the next hop of the default route.
• As shown in the figure, three routes with the same destination network segment (10.1.1.1/32) are configured on Router B. They have the same default preference of 60.
No other routes to the same destination have higher preference than the three routes.
In this case, the three routes are equal-cost routes. Packets can be load balanced among the three links.
• There are three routes to the same destination network segment (10.1.1.1/32). Packets are load balanced among the links.
• As shown in the figure, two static routes to the destination network segment (10.1.1.1/32) are configured on Router B. One has the default preference of 60, and the other has the preference of 100.
• There is only one route whose destination network segment is 10.1.1.1/32 in the routing table. The preference of the route is 60. This route serves as the primary route.
The route with the preference of 100 is not added to the routing table. Only when the route with the preference of 60 is invalid, the route with the preference of 100 is added to the routing table.
• Run the shutdown command to shut down an interface on the active link and check the routing table. In this case, the backup route becomes the primary route
automatically and is added to the routing table to guide packet forwarding.
• When you run the ip route-static command to configure a static route and set the destination address to 0.0.0.0 and mask to 0.0.0.0, this route is the default route.