For an unobstructed network, the routers in the network need to know how to forward packets to each network segment. Routers forward packets based on a routing table, which can be constructed through directly connected networks, static routing, and dynamic routing.

Static routing is to manually add a routing entry to the router. By configuring static routing, floating static routes can be enabled, which means that the router will automatically choose an alternate path when the optimal path is not available.

IP addresses, if planned properly, can implement route summarization on the area border router. Route summarization simplifies the routing table and improves the speed of table lookup.

Default routing is a special kind of static routing, which means a router makes its choice when there is no route in the routing table that matches the destination address of a packet. If there is no default routing, packets whose destination address does not have a matching route in the routing table will be discarded. Having a gateway set up on a Windows system is tantamount to adding a default route to the Windows system.

5.1 Basic Concepts of Route

5.1.1 What Is a Route

In network communication, the term “Route” is a network layer term that refers to the path a packet takes from a network device to the destination. A router (or Layer 3 device) in a network is responsible for selecting the forwarding path for packets. As shown in Fig. 5.1, a router has a routing table, which consists of a number of routing messages. In the routing table, a piece of routing information is also called a routing entry, and the router selects the forwarding path for the packets according to the routing table. Routing tables exist only in end computers and routers (and Layer 3 devices); they do not exist in Layer 2 switches.

Fig. 5.1
figure 1

IP routing

As shown in Fig. 5.1, PC1 sends PC2 a packet with a source IP address of 11.1.1.2 and a destination IP address of 12.1.1.2. Router R1 receives the packet and checks the routing table and finds a route to network segment 12.1.1.0/24, and the next hop is to 172.16.0.2, so the packet is sent from interface GE 0/0/0 of router R1 to router R2; after receiving it, router R2 checks the routing table, and finds that there is a route to network segment 12.1.1.0/24, and the next hop is to 172.16.1.2, so the packet is sent from interface GE 0/0/1 of router R2 to router R3; after receiving the packet, router R3 checks the routing table and finds a route to network segment 12.1.1.0/24, and the next hop is 12.1.1.1, which is the address of interface GE 0/0/1 of router R3, so the packet is sent out from GE 0/0/1 and finally arrives at PC2. When PC2 sends a packet to PC1, it also needs the routers along the way to query the routing table so as to determine the forwarding path.

It should be noted that if the next hop IP address of a routing entry is the IP address of the outgoing interface, it means that the interface is directly connected to the destination network indicated by the routing entry. It is also important to note that the host interface corresponding to the next hop IP address must be on the same Layer 2 network (Layer 2 broadcast domain) as the outgoing interface.

Here is a routing table of an actual router. By entering “display ip routing-table”, you can see the routing table.

[AR1]display ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 14 Routes : 14 Destination/Mask Proto Pre Cost Flags NextHop Interface …… 172.16.0.0/24 Direct 0 0 D 172.16.0.1 Serial2/0/0 172.16.0.2/32 Direct 0 0 D 172.16.0.2 Serial2/0/0 172.16.1.0/24 OSPF 10 96 D 172.16.0.2 Serial2/0/0 192.168.0.0/24 Direct 0 0 D 192.168.0.1 Vlanif1 192.168.1.0/24 OSPF 10 97 D 172.16.0.2 Serial2/0/0 192.168.10.0/24 Static 60 0 RD 172.16.0.2 Serial2/0/0 ……

As you can see, the routing table has 14 destinations and 14 routes.

Each field of the routing entry is explained below.

  • Destination/Mask represents the destination and subnet mask.

  • Proto, short for Protocol, indicates the protocol through which the routing entry is generated. “Direct” means a directly connected network segment, a route that is automatically discovered. OSPF specifies that the routing entry is a dynamic route constructed via the OSPF protocol, and “Static” indicates that the routing entry is a manually configured static route.

  • Pre is short for Preference, and is used to reflect the preference of the source of routing information.

  • The cost of a route is one of its imperative attributes. The router selects the optimal forwarding path for the packet, which is also the path with low cost.

  • Flags means route flags, R means the route is an iterative route, and D means the route is delivered to the FIB table.

  • NextHop represents the next hop, i.e., which is the next closest router a packet can go through to get to the destination, so that the router can determine which exit the packet should be sent out from.

  • Interface indicates the next hop exit to arrive at the destination network segment.

5.1.2 Sources of Routing Information

A routing table contains a number of routing information, which is generated in three ways: direct routing, static routing, and dynamic routing.

  1. 1.

    Direct routes

    We call the routing information automatically discovered by the device a direct route. After the network device starts up, when the router interface status is UP, the router can automatically discover routes to the network directly connected to its own interface.

    As shown in Fig. 5.2, when the status of interface GE 0/0/1 of router R1 is UP, R1 can infer that the network address of the network where GE 0/0/1 interface is located is 11.1.1.1/24 based on the IP address of interface GE 0/0/1 is 11.1.1.1/24. Then, R1 will fill 11.1.1.0/24 into its routing table as a routing entry. The destination/mask of this route is 11.1.1.0/24, the outgoing interface is GE 0/0/1, and the next hop IP address is the same as the IP address of the outgoing interface, that is 11.1.1.1. Since this is a direct route, its protocol attribute is direct. In addition, the value of cost is always 0 for a direct route.

    Similarly, router R1 will automatically discover another direct route with a destination/mask of 172.16.0.0/24, an outgoing interface of GE 0/0/0, a next hop address of 172.16.0.1, a protocol attribute of direct, and a cost of 0.

    You can see that as soon as R1, R2 and R3 in the network are turned on and the ports are up, the network segments connected to these interfaces will appear in the routing table.

  2. 2.

    Static routes

    For computers in the network to be able to access any network segment in the network, the routers in the network must have routes to all the network segments. For segments that are directly connected to the router, the router can automatically discover them and add them to the routing table. For those that are not directly connected, the administrator needs to manually add them to the routing table. The manually configured routing information of the router is called static route and is suitable for smaller networks or relatively stable networks.

    As shown in Fig. 5.3, there are four network segments in the network, and each router is directly connected to two network segments. For the segments that are not directly connected, static routes need to be manually added, that is, two static routes need to be added to each router. Pay attention to the next hop of the static route. When the route to the network segment 12.1.1.0/24 is added to R1, the next hop is the interface address 172.16.0.2 of R2 that is directly connected to R1, rather than 172.16.1.2 of interface GE 0/0/0 of R3. Note that many beginners are prone to misunderstand “next hop”.

  3. 3.

    Dynamic routes

    The routing information obtained by a router using dynamic routing protocols (such as RIP, OSPF, etc.) is called a dynamic route. A dynamic route is suitable for larger networks and can automatically select the optimal path according to changes in the network.

    If the network is small, we can “tell” the network devices the routes to those non-directly connected networks by manual configuration. However, if there are a great many non-directly connected networks, manual configuration inevitable requires massive labor work, which is often undesirable, if not impossible, in reality. In addition, manually configured static routes have an obvious drawback, that is, they are not adaptive. In the case of erroneous or ineffective static routes caused by a network failure or network structure change, these static routes must be manually modified, which in reality is also often undesirable or impossible.

    In fact, network devices can also obtain routing information by running routing protocols. The terms “routing protocol” and “dynamic routing protocol” are actually the same thing. The routes that a network device obtains by running a routing protocol are called dynamic routes. If a new network segment is added to the network, a network segment is deleted, or the network segment of an interface or the network topology is changed (a link is broken or added to the network), the routing protocol can update the routing information in the routing table.

    It is important to note that a router can simultaneously run multiple routing protocols. As illustrated in Fig. 5.4, router R2 runs both the RIP routing protocol and OSPF routing protocol. At this point, the router will create and maintain an IP routing table, as well as a RIP routing table and an OSPF routing table. The RIP routing table is dedicated to all routes discovered by the RIP protocol, while the OSPF routing table is to all routes discovered by the OSPF protocol.

    The routing entries in both the RIP routing table and the OSPF routing table are added to the IP routing table, and if both the RIP and the OSPF routing table have routing entries to a particular network segment, routing protocol preferences shall be compared. In Fig. 5.4, Router R2 has routing information for the network segment 24.6.10.0/24 in both the RIP routing table and the OSPF routing table. Since the OSPF protocol has a higher preference than the RIP protocol, the routing entry 24.6.10.0/24 in the OSPF routing table is added to the IP routing table. And the router eventually refers to the IP routing table to forward IP messages.

Fig. 5.2
figure 2

Direct routes

Fig. 5.3
figure 3

Configure static routes

Fig. 5.4
figure 4

Dynamic route preference

5.1.3 Route Preferences

Suppose a Huawei AR router runs both routing protocols, RIP and OSPF, and RIP discovers a route to the destination/mask z/y, and OSPF also discovers a route to the destination/mask z/y. In addition, we also manually configured a route to the destination/mask z/y. In other words, the device simultaneously obtains three different routes to the same destination/mask, so which route will the device actually use to forward the IP message? Or which of these three routes will be added to the IP routing table?

In fact, we specify different preferences for routes from different sources, and stipulate that the smaller the value of the preference, the higher the preference of the route. In this way, when there are multiple routes with the same destination/mask but different sources, the route with the highest preference becomes the optimal route and is added to the IP routing table, while the other routes remain inactive and are not displayed in the IP routing table.

The route preference on a device generally has a default value. Devices of different vendors have different rules for the default value of route preference. The default values of some of the route preferences of Huawei AR routers are specified in Table 5.1. These are the default preferences. Preferences can be changed, for example, when adding a static route, you can specify the preference of that route. The value range of preferences is from 0 to 255.

Table 5.1 Route preferences

5.1.4 Route Cost

Route cost is a very important property of a route. The cost of a route is the value that needs to be paid to reach the destination/mask of this route. When a routing protocol finds multiple routes to reach the same destination/mask, it will select the route with the lowest cost, i.e., only the route with the lowest cost will be added to the routing table of this protocol.

The specific definition of cost varies from one routing protocol to another. For example, RIP protocol can only use “hop count” as the cost. By hop count, we mean the number of routers that need to be passed to reach the destination/mask. As shown in Fig. 5.5, all the routers in the network run RIP protocol. Router R1 finds two routes to the network segment 2.0.0.0/8 via RIP protocol: the first route exits at GE 1/0/0 of R1, with the next hop being the address of interface GE 0/0/0 of R2, and a cost (hop count) of 3 (router R1 needs to go through three routers, R2, R3, R5, to reach the network segment 2.0.0.0/8); the second route exits at GE 0/0/0 of R1, with the next hop being the address of interface GE 1/0/0 of R4, and a cost (hop count) of 2 (router R1 needs to go through two routers, R4 and R5 to reach network segment 2.0.0.0/8). Obviously, the cost of Path 2 is less than that of Path 1, so the second route is the optimal route and will be added to the RIP routing table of router R1.

Fig. 5.5
figure 5

RIP protocol uses “hop count” as the cost of the route

When the same routing protocol finds multiple routes that reach the same destination/mask and the costs of these routes are equal, what should we do? As shown in Fig. 5.6, assume that R1, R2, R3 and R4 are all running RIP routing protocol. By running RIP protocol, R1 will find two routes to 2.0.0.0/8: the first route exits at GE 1/0/0 of R1 and the next hop is the address of interface GE 0/0/0 of R2; the second route exits at GE 0/0/0 of R1 and the next hop is the address of interface GE 1/0/0 of R4. The costs (hop counts) of Path 1 and Path 2 are equal, so they are called equal-cost routes. In this case, both routes are added to the RIP routing table of R1. If these two routes in the RIP routing table can be preferentially added into the IP routing table, then when R1 forwards traffic to 2.0.0.0/8, some of the traffic will be forwarded according to the first route and the other will be forwarded according to the second route, a situation also known as load balance.

Fig. 5.6
figure 6

Equal-cost routes

In particular, it is important to emphasize that the comparison of costs is meaningful only within the same routing protocol and the route costs between different routing protocols are not comparable and there is no conversion relationship because the specific definition of cost varies for different routing protocols.

If a router is running multiple routing protocols at the same time, and one or more routes are discovered by each routing protocol for the same destination/mask (which assumed to be z/y), each routing protocol determines the optimal route among the several routes it has discovered based on the comparison of the costs, and puts the optimal route into the routing table of this protocol. Then, the optimal routes determined by different routing protocols are compared with each other in terms of route preference, and the route with the highest preference is added to the IP routing table of that router as the route to z/y. Note that if there are also direct routes or static routes to z/y on the router, then these direct routes and static routes shall also be taken into consideration when comparing preferences. The route with the highest preference is eventually added to the IP routing table as the route to z/y.

5.1.5 Conditions for an Unobstructed Network

The condition for an unobstructed computer network is that packets can be sent and returned. This is easy to understand, but it is the theoretical basis for troubleshooting the network.

As shown in Fig. 5.7, for Computer A in the network to communicate with Computer B, all routers along the way must have a route to the destination network 192.168.1.0/24, and for Computer B to return a packet to Computer A, all routers along the way must have a route to reach network 192.168.0.0/24.

Fig. 5.7
figure 7

Conditions for an unobstructed network

Based on the above principles, network troubleshooting becomes simple. If the network is not working, you have to check whether the computer is configured with the correct IP address, subnet mask, and gateway, then check the routing table on each router along the way to see if there is a route to the destination network, and then check the routing table on each router along the way see if there are routes for packets to return.

5.2 Static Routing

5.2.1 Basic Concepts of Static Routing

Static routing is a form of routing that occurs when the routing entry is manually configured rather than dynamically decided. Unlike dynamic routing, static routing is fixed and does not change, even if the network conditions have changed. Generally speaking, static routes are added to the routing table by the network administrator one by one.

One advantage of using static routing is that the network is secure and highly confidential. Dynamic routing requires frequent exchange of respective routing tables between routers, and analysis of a routing table reveals information such as network topology and network addresses, so networks can use static routing for security. Static routing does not generate update traffic and does not consume network bandwidth.

Static routing is generally not suitable for large and complex network environments. On the one hand, it is difficult for network administrators to have a comprehensive understanding of the entire network topology; and on the other hand, when the network topology and link state change, the static routing information in the routers needs to be adjusted on a large scale, which is an extremely difficult and complex task. In addition, when the network changes or the network fails, the route cannot be re-routed, which may lead to the route failures.

5.2.2 Notes on Static Routing Configuration

To enable network-wide communication, that is, any two nodes in the network can communicate with each other, it is required that all routers in the network must have routes to all network segments in their routing tables. For routers, network segments that are directly connected to the interface are automatically added to the routing table, while routes to those non-directly connected network segments need to be manually added by the administrator.

The network topology in Fig. 5.8 has four network segments, A, B, C, and D. The IP addresses of the computers and router interfaces have been marked in the figure. How can the three routers AR1, AR2, and AR3 in the network add routes to make the whole network connected?

Fig. 5.8
figure 8

Commands for adding static routes

Router AR1 is directly connected to two network segments A and B, and is not directly connected to network segments C and D, so the routes to network segments C and D shall be added.

Router AR2 is directly connected to two network segments B and C, and is not directly connected to network segments A and D, so the routes to network segments A and D shall be added.

Router AR3 is directly connected to two network segments C and D, and is not directly connected to network segments A and B, so the routes to network segments A and B shall be added.

To configure static routing on the router, you need to enter system view, and then execute the command ip route-static ip-address {mask | mask-length} {nexthop-address | interface-type interface-number [nexthop-address]} [preference preference], where ip-address {mask | mask-length} denotes the destination/mask, nexthop-address represents the next hop IP address, interface-type interface-number is the outgoing interface, and preference denotes the route preference.

Here we must correctly understand the “next hop”. As shown in Fig. 5.8, when adding a route to the network segment 192.168.1.0/24 to router AR1, the next hop is the IP of the adjacent device interface, i.e., the address of interface Serial 2/0/1 of router AR2, rather than the address of interface Serial 2/0/1 of router R3.

If the packets go through a point to point link to get to the destination network, there is another format for adding a static route, with the destination address and mask followed by the configured exit information. For example, you can add a route to network segment 192.168.1.0/24 on router AR2 as shown in Fig. 5.9. Note that Serial 2/0/0 at the end is the interface of router AR2, which tells router AR2 that the packets to the network segment 192.168.1.0/24 are sent out from interface Serial 2/0/0.

Fig. 5.9
figure 9

Configure exit information for point to point link routing

As shown in Fig. 5.10, if the routers are connected to each other by Ethernet, it is better to write the next hop address instead of the router’s exit when adding a route. Think about it: why is that?

Fig. 5.10
figure 10

It is suggested to add the next hop address for Ethernet interface

Multiple computers or routers can be connected in the Ethernet, and if you add a route without writing the next hop address, you cannot tell which interface should receive the packet at the next hop. A point to point link does not have this problem. One end sends and the other receives, so no data link layer address is used at all.

The router only cares about how packets are forwarded to a certain network segment, so when adding a route to a router, it must be a route to a network segment (subnet), rather than a route to a specific address. When adding a route to a network segment, you have to make sure that the host bits of the IP address are all 0s. For example, the following route is added incorrectly, because 172.16.1.2 24 is not a network, but an IP address in the network 172.16.1.0 24.

[AR1]ip route-static 172.16.1.2 24 172.16.0.2 Info: The destination address and mask of the configured static route mismatched , and the static route 172.16.1.0/24 was generated.  –Wrong address and subnet mask

If you want to add a route to a specific IP address (host route), the subnet mask should be written as four 255, which means that all 32 bits of the IP address are network bits.

[AR1]ip route-static 172.16.1.2 32 172.16.0.2      --Add a route to network segment 172.16.1.2/32

5.2.3 Examples of Configuring Static Routing

This section describes the configuration of static routes through a case study.

As shown in Fig. 5.11, set the IP addresses of the computers and router interfaces in the network, and the gateways also need to be set for both PC1 and PC2. As you can see, there are four network segments in this network. Now you need to add routes to the router to enable an unobstructed network access of these four network segments.

Fig. 5.11
figure 11

Static routing network topology

Once the IP address and subnet mask are configured for the router interface, the routing table of the router has routes to the directly connected network segments and there is no need to add routes to those segments. You need to check the routing table of the router before adding a static route.

On router AR1, by going to the system view and entering “display ip routing-table”, you can see the routes to the two directly connected segments.

[AR1]display ip routing-table  Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public         Destinations : 11       Routes : 11    Destination/Mask    Proto   Pre  Cost   Flags NextHop    Interface       127.0.0.0/8   Direct  0    0      D   127.0.0.1    InLoopBack0       127.0.0.1/32  Direct  0    0      D   127.0.0.1    InLoopBack0 127.255.255.255/32  Direct  0    0      D   127.0.0.1    InLoopBack0      172.16.0.0/24  Direct  0    0      D   172.16.0.1   Serial2/0/0   --Route to a directly connected network segment      172.16.0.1/32  Direct  0    0      D   127.0.0.1    Serial2/0/0      172.16.0.2/32  Direct  0    0      D   172.16.0.2   Serial2/0/0    172.16.0.255/32  Direct  0    0      D   127.0.0.1    Serial2/0/0     192.168.0.0/24  Direct  0    0      D   192.168.0.1  Vlanif1       --- Route to a directly connected network segment     192.168.0.1/32  Direct  0    0      D   127.0.0.1    Vlanif1   192.168.0.255/32  Direct  0    0      D   127.0.0.1    Vlanif1 255.255.255.255/32  Direct  0    0      D   127.0.0.1    InLoopBack0

You can see that there are already route entries in the routing table to the two directly connected network segments.

Add static routes to AR1, AR2, and AR3.

  1. 1.

    Add routes to network segments 172.16.1.0/24 and 192.168.1.0/24 to router AR1 to display the added static routes.

[AR1]ip route-static 172.16.1.0 24 172.16.0.2       --Add a static route and next hop address [AR1]ip route-static 192.168.1.0 255.255.255.0 Serial 2/0/0    --Add a static route and egress [AR1]display ip routing-table                        --Display routing table [AR1]display ip routing-table protocol static       --Display only static routing table Route Flags: R - relay, D - download to fib ----------------------------------------------------------------------------- Public routing table : Static      Destinations : 2        Routes : 2        Configured Routes : 2 Static routing table status : <Active>      Destinations : 2        Routes : 2 Destination/Mask    Proto   Pre  Cost      Flags   NextHop        Interface   172.16.1.0/24  Static   60   0          RD   172.16.0.2      Serial2/0/0 192.168.1.0/24  Static   60   0           D   172.16.0.1      Serial2/0/0 Static routing table status : <Inactive>      Destinations : 0        Routes : 0 

  1. 2.

    Add routes to network segments 192.168.0.0/24 and 192.168.1.0/24 to router AR2.

[AR2]ip route-static 192.168.0.0 24 172.16.0.1 [AR2]ip route-static 192.168.1.0 24 172.16.1.2

  1. 3.

    Add routes to network segments 192.168.0.0/24 and 172.16.0.0/24 to router AR3.

[AR3]ip route-static 192.168.0.0 24 172.16.1.1 [AR3]ip route-static 172.16.0.0 24 172.16.1.1

Delete route to network segment 192.168.1.0/24 on Router AR2.

[AR2]undo ip route-static 192.168.1.0 24     --Delete a route to a network segment, and there is no need to specify next hop address

PC1 pings PC2, then it shows “Request timeout!”, but in fact the destination host is unreachable.

Not all “Request timeout” are caused by the router’s routing table. There may be other reasons for “Request timeout”, such as the destination computer being enabled with a firewall or shutdown.

5.2.4 Floating Static Routes

A floating static route, also known as a backup route, consists of two or more links. When there are multiple paths to a network, the primary and backup paths can be specified by setting different preferences for the static routes. When the primary path is not available, a static route that takes an alternate path is added to the routing table, and packets are forwarded to the destination network through the alternate path, which is the floating static route.

As shown in Fig. 5.12, the optimal path from network segment A to network segment B is AR1 → AR3, and when the optimal path is not available, you can take the alternate path AR1 → AR2 → AR3. That is when the floating static route needs to be configured. When adding a static route, the preference can be specified, and the values of this parameter range from 1 to 255. The larger the value, the lower the preference, and the directly connected network takes the preference of 0, while the default preference of the static route is 60.

Fig. 5.12
figure 12

Alternate path

Add two static routes to network segment 192.168.1.0/24 to AR1, using the default preference for the primary path and setting the static route preference to 100 for the alternate path.

[AR1]ip route-static 192.168.1.0 24 172.16.2.2 --Default preference is 60 [AR1]ip route-static 192.168.1.0 24 172.16.2.2 preference ? INTEGER<1-255> Preference value range [AR1]ip route-static 192.168.1.0 24 172.16.0.2 preference 100

Add two static routes to network segment 192.168.0.0/24 to AR3, using the default preference for the primary path and setting the static route preference to 100 for the alternate path.

[AR3]ip route-static 192.168.0.0 24 172.16.2.1 [AR3]ip route-static 192.168.0.0 24 172.16.1.1 preference 100

Add a static route to the network segments 192.168.0.0/24 and 192.168.1.0/24 on AR2.

[AR2]ip route-static 192.168.0.0 24 172.16.0.1 [AR2]ip route-static 192.168.1.0 24 172.16.1.2

When you look at the routing table on AR1, you can see the route for the primary path while the static route for the alternate path is not added to the routing table.

[AR1]display ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 14 Routes : 14 Destination/Mask Proto Pre Cost Flags NextHop Interface …… 192.168.0.0/24 Direct 0 0 D 192.168.0.1 Vlanif1 192.168.0.1/32 Direct 0 0 D 127.0.0.1 Vlanif1 192.168.0.255/32 Direct 0 0 D 127.0.0.1 Vlanif1 192.168.1.0/24 Static 60 0 RD 172.16.2.2 GigabitEthernet0/0/1 255.255.255.255/32 Direct 0 0 D 127.0.0.1 InLoopBack0

By viewing all static routes, the route for the primary path and the static route for the alternate path will be displayed. “Active” means the route is added to the IP routing table, while “Inactive” means it is not added to the table.

<AR1>display ip routing-table protocol static Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Public routing table : Static Destinations : 1 Routes : 2 Configured Routes : 2 Static routing table status : <Active> Destinations : 1 Routes : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.1.0/24 Static 60 0 RD 172.16.2.2 GigabitEthernet0/0/1 Static routing table status : <Inactive> Destinations : 1 Routes : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.1.0/24 Static 100 0 R 172.16.0.2 GigabitEthernet0/0/0

Shut down the interface of the primary path on AR1, and check the routing table again, then you can see that the static route of the alternate path is in effect.

[AR1]interface GigabitEthernet 0/0/1 [AR1-GigabitEthernet0/0/1]shutdown <AR1>display ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ …… Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.0.255/32 Direct 0 0 D 127.0.0.1 Vlanif1 192.168.1.0/24 Static 100 0 RD 172.16.0.2 GigabitEthernet0/0/0

5.3 Route Summarization

The Internet is the largest interconnected network in the world, and if the routers on the Internet add all network segments around the world to the routing table, it will become a massive routing table. For each packet forwarded by a router, the routing table has to be checked to select a forwarding exit for that packet, so a huge routing table will inevitably increase the processing time delay.

If network segments with consecutive addresses are assigned to networks in physically continuous locations, you can combine remote network segments into a single route at the routing border, which is called route summarization. Route summarization can significantly reduce routing table entries on a router.

5.3.1 Simplify Routing Tables with Route Summarization

The following example shows how to implement route summarization.

As shown in Fig. 5.13, networks in Beijing can be considered as networks in physically continuous locations. Assign consecutive network segments for the networks in Beijing, that is, all network segments from 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24, 192.168.4.0/24 to 192.168.255.0/24.

Fig. 5.13
figure 13

Address planning

Networks in Shijiazhuang can also be considered to be in physically continuous locations. Assign consecutive network segments for the networks in Shijiazhuang, that is, all network segments from 172.16.0.0/24, 172.16.1.0/24, 172.16.2.0/24, 172.16.3.0/24, 172.16.4.0/24 to 172.16.255.0/24.

Add routes to all network segments in Shijiazhuang to the router in Beijing. If you add a route for each network segment, 256 routes are needed in total. When adding routes to all network segments in Shijiazhuang to the router in Beijing, if you add a route for each network segment, likewise, 256 routes are needed in total.

Subnets 172.16.0.0/24, 172.16.1.0/24, 172.16.2.0/24 to 172.16.255.0/24 in Shijiazhuang belong to network segment 172.16.0.0/16, which includes all network segments starting with 172.16. Therefore, for the router in Beijing, the network of Shijiazhuang is a network segment of 172.16.0.0/26, and it will suffice by adding a route to network segment 172.16.0.0/16 to the router in Beijing.

Network segments in Beijing from 192.168.0.0/24, 192.168.1.0/24, 192.168.2.0/24, 192.168.3.0/24, 192.168.4.0/24 to 192.168.255.0/24 can also be combined into a network segment 192.168.0.0/16 (at this point, you must recall how to merge network segments discussed in the chapter about IP address and subnetting, that is, by moving the subnet mask eight bits to the left to merge 256 Class C networks), which includes all network segments starting with 192.168. Therefore, it will suffice by adding a route to network segment 192.168.0.0/16 to the router in Beijing.

After summarization, for all routers in Beijing, only one route to the network of Shijiazhuang needs to be added, and for all routers in Shijiazhuang only one route to the network of Beijing needs to be added, so the routing table is significantly streamlined. Figure 5.14 draws only the routes added to R4 and R5. Furthermore, one route to the network of Shijiazhuang also needs to be added to R1, R2, and R3, while one route to the network of Beijing needs to be added to R6, R7, R8, R9 and R10.

Fig. 5.14
figure 14

Route summarization can be performed after address planning

Furthermore, as shown in Fig. 5.15, if the network of Shijiazhuang uses network segments from 172.0.0.0/16, 172.1.0.0/26, 172.2.0.0/16 to 172.255.0.0/16, that is, all segments starting with 172 are in Shijiazhuang, then these segments can be merged into one network segment 172.0.0.0/8, and only one route needs to be added to the router in Beijing. If the network of Beijing uses network segments from 192.0.0.0/16, 192.1.0.0/16, 192.2.0.0/16 to 192.255.0.0/26, that is, all network segment starting with 192 is in Beijing, then these segments can be merged into one network segment 192.0.0.0/8, and only one route needs to be added to the router in Shijiazhuang.

Fig. 5.15
figure 15

Route summarization

The rule is clear, that is, when adding routes, the fewer the network bits (the fewer the number of 1s in the subnet mask), the more the network segments can be summarized using the route summarization.

5.3.2 Longest Prefix Match

The longest prefix match (LPM) is a routing lookup mechanism used by default by almost all routers in the industry today.

Each entry in the routing table of a router specifies a network, and if these network addresses overlap, a destination address may match with multiple entries. When a router receives an IP packet, it compares the packet’s destination IP address with all the routing entries in the local routing table bit by bit until it finds the entry with the longest match. This is the longest prefix match mechanism. It is called this because it is also the entry where the largest number of leading address bits of the destination address match those in the table entry.

In the following, the application case of longest prefix match is explained.

As shown in Fig. 5.16, a network in Beijing uses network segment 172.16.10.0/24, and later a network in Shijiazhuang is connected to the network in Beijing and according to the network planning, Shijiazhuang uses network segments starting with 172.16. In this case, can the router in Beijing still summarize the routes to the networks in Shijiazhuang into a single route? In this case, the router in Beijing can still summarize the routes to the networks in Shijiazhuang into a single route, but a separate route needs to be added for the exception network segment, as shown in Fig. 5.16.

Fig. 5.16
figure 16

Route summarization exception

If router R1 receives a packet with a destination address of 172.16.10.2, which route should be used for path selection?

Since the destination address of this packet matches both route ① and route ②, the router will use the most precisely matched route ② to forward the packet. This is called longest prefix match.

In another example, the following four routes is added to the router.

[R1]ip route-static 172.0.0.0  255.0.0.0  10.0.0.2               --Route 1 [R1]ip route-static 172.16.0.0  255.255.0.0  10.0.1.2              --Route 2 [R1]ip route-static 172.16.10.0  255.255.255.0  10.0.3.2          --Route 3 [R1]ip route-static 172.16.10.10  255.255.255.255  10.0.4.2         --Route 4

When receiving a packet with a destination address of 172.16.10.10, router R1 forwards the packet using Route 4. When receiving a packet with a destination address of 172.16.10.12, router R1 forwards the packet using Route 3. And when receiving a packet with a destination of 172.18.17.12, router R1 forwards the packet using Route 1. These are the routes selected according to the longest prefix match.

A routing table often contains a default route. This route has the shortest prefix match when all table entries do not match. The application of the default route will be explained later.

5.3.3 Classless Inter-Domain Routing

To make it easy for readers to understand, the routing summarization introduced above merges 256 network segments by shifting the subnet mask 8 bits to the left. Classless inter-domain routing (CIDR) uses 13 to 27 bits variable network IDs instead of the fixed 8-, 16-, and 24-bit network IDs used for Class A, B, and C networks. This allows the subnet mask to be shifted one bit to the left to merge two network segments, two bits to the left to merge four network segments, three bits to the left to merge eight network segments, and n bits to the left to merge 2n network segments.

The following is an example of how CIDR can flexibly and accurately merge consecutive subnets.

As shown in Fig. 5.17, there are four consecutive Class C networks in Area A. By shifting the subnet mask two bits to the left, these four Class C networks can be merged into network segment 192.168.16.0/22. There are two consecutive subnets in Area B. By shifting the subnet mask one bit to the left, these two network segments can be merged into network segment 10.7.78.0/23.

Fig. 5.17
figure 17

Simplify routing table using CIDR

To improve the learning effect, readers are suggested to study this section in conjunction with Chap. 4, “IP Addresses and Subnetting”.

5.4 Default Routing

5.4.1 Overview of Default Routing

A default route is a special kind of static route that is selected by a router when there is no route in the routing table that matches the destination address of a packet. If there is no default route, then packets whose destination address does not have a matching route in the routing table will be discarded. Default routes are useful in some cases, such as in routers connected to end networks, where using a default route will significantly simplify the router’s routing table, thus reducing the workload of administrators, and improving network performance.

5.4.2 The Writing of Default Routing

Before we talk about default routing, let’s take at a look at how the largest network segment in the world is represented in a router. Add the following three routes to the router.

[R1]ip route-static 172.0.0.0  255.0.0.0  10.0.0.2             --Route 1 [R1]ip route-static 172.16.0.0  255.255.0.0  10.0.1.2           --Route 2 [R1]ip route-static 172.16.10.0  255.255.255.0  10.0.3.2          --Route 3

As you can see from the three routes above, the shorter the subnet mask (the fewer the number of 1s when the subnet mask is written in binary), and the more the host bits, the larger the number of addresses in the network segment.

If you want a network segment to include all IP addresses, the subnet mask needs to be as short as possible, that is 0. The subnet mask becomes 0.0.0.0, which means that the 32-bit binary IP address for that network segment is all host bits, and all addresses belong to that network segment. Therefore, a network segment whose subnet mask is 0.0.0.0 includes all IPv4 addresses in the world, which means it is the largest network segment in the world. It can also be written as 0.0.0.0/0.

The route added to the network segment “0.0.0.0 0.0.0.0” to the router is the default route.

[R1]ip route-static 0.0.0.0 0.0.0.0 10.0.0.2                    --Route 4

Any destination address matching the default route, which, according to the “longest prefix match” algorithm mentioned earlier, is the last route to match if the router does not find a more accurate match for the packet.

The following part introduces some classic application scenarios for default routes.

5.4.3 Simplify Routing Tables with Default Routing

This case is an application scenario of default routing.

A company intranet has four routers A, B, C, and D, and six network segments 10.1.0.0/24, 10.2.0.0/24, 10.3.0.0/24, 10.4.0.0/24, 10.5.0.0/24, and 10.6.0.0/24. The network topology and address planning are illustrated in Fig. 5.18. Now it is required to add routes in these four routers so that the six network segments of the intranet can communicate with each other and also access the Internet.

Fig. 5.18
figure 18

Simplify routing tables by default route

Routers B and D are the end routers of the network, and are directly connected to two network segments. Packets have to be forwarded to Router C for them to reach other networks. Only one default route needs to be added to these two routers.

For Router C, which is directly connected to three network segments, the routes to 10.1.0.0/24 and 10.4.0.0/24 need to be added separately, while all packets to the Internet network segment 10.6.0.0/24 need to be forwarded to Router A, so adding a default route will suffice.

For Router A, which is directly connected to three network segments, separate routes need to be added for the intranets that are not directly connected, while a single default route is enough as the route to all network segments on the Internet.

Observe Fig. 5.18: can the routing table in Router A be further simplified? The network segments used by the enterprise intranet can be merged into network segment 10.0.0.0/8. Therefore, the routes to the intranet segments can be summarized into one in Router A, as shown in Fig. 5.19. Think about it: can the routing table in Router C be further simplified?

Fig. 5.19
figure 19

Route summarization of routers and simplify routing table by default routing

5.4.4 Simplify Routing Tables with Route Summarization

The Internet is the largest interconnected network and the network with the largest number of network segments in the world. For computers throughout the Internet to communicate with each other, the routing tables of routers on the Internet must be properly configured. If the public IP addresses are properly planned, the routing tables of the routers on the Internet can be greatly simplified using default routes and route summarization.

The following are examples of IP address planning on the Internet and how routers at all levels of the network can use default routes and route summarization to simplify routing tables. For the sake of illustration, only three countries are drawn here (Fig. 5.20).

Fig. 5.20
figure 20

Internet address planning illustration

National-level network planning: China uses network segment 40.0.0.0/8, the UK uses network segment 30.0.0.0/8, and the US uses network segment 20.0.0.0/8, with each country assigned a large network segment to facilitate route summarization.

Provincial IP address planning in China: Hebei Province uses network segment 40.2.0.0/16, Henan Province uses network segment 40.1.0.0/16, and other provinces use network segments from 40.3.0.0/16, 40.4.0.0/16 to 40.255.0.0/16.

IP address planning in Hebei Province: Shijiazhuang area uses network segment 40.2.1.0/2, Qinhuangdao area uses network segment 40.2.2.0/24, and Baoding area uses network segment 40.2.3.0/24 network segment.

Routes are added as shown in Fig. 5.21. Routers A, D, and E are international exit routers for China, the UK, and the US, respectively. For routers at this level, you only need to add a route “40.0.0.0 255.0.0.0” to China, a route “20.0.0.0 255.0.0” to the US, and a route “30.0.0.0 255.0.0.0” to the UK. The routing table of routers at this level is streamlined because the IP addresses are well planned so that the networks in a country can be summarized into a single route.

Fig. 5.21
figure 21

Simplify routing by route summarization and default routing

For the international exit Router A in China, in addition to adding routes to the US and the UK, you also need to add routes to Henan Province, Hebei Province and other provinces. Since the IP addresses of each province are also well planned, the network of each province can be summarized into a single route, so the routing tables of the routers at this level are also simplified.

How does Router C in Hebei Province add its routes? For Router C, apart from being sent to the networks in Shijiazhuang, Qinhuangdao and Baoding areas, packets are either sent out of the province or out of the country, so they need to be forwarded to Router A. Routes to the networks in Shijiazhuang, Qinhuangdao and Baoding areas are to be added in the provincial Router C, and routes to other networks use a default route to Router A. routers at this level can also use default routes to simplify the routing table.

For Routers H, G, and F at the network end, adding a default route to the provincial Router C is enough.

In summary: if the network address planning is rational, routers on the backbone network can use route summarization to streamline the routing table, while routers at the network end can use default routing to streamline the routing table.

5.4.5 Routing on a Ring Network Caused by Default Routing

As shown in Fig. 5.22, Routers RA, RB, RC, RD, RE, and RF in the network are connected into a ring. To enable the smooth connection of the whole network, you only need to add a default route in each router to the address of the next router, which is configured as shown in Fig. 5.22. By configuring the routes in this way, packets in the network will pass clockwise along the loop.

Fig. 5.22
figure 22

Ring network using default routes

The following takes the communication between Computer A and B in the network as an example. As shown in Fig. 5.23, the packet from Computer A to B passes through routers RF → RA→RB → RC → RD → RE, and the packet from Computer B to A passes through routers RE → RF. As you can see, the path of the packet to the destination address and the return path are not necessarily the same, and the routing table is the sole one to decide which path the packet takes.

Fig. 5.23
figure 23

Packet round trip path

There is no network segment 40.0.0.0/8 in the ring network. What happens if Computer A pings the address 40.0.0.2?

If Computer A pings the address 40.0.0.2, all routers will forward the packet to the next router by the default route. The packet will keep being forwarded clockwise in this ring network and will never reach the destination network, consuming network bandwidth all the time, which creates a routing loop. Fortunately, the network layer header of the packet has a field to specify the packet’s time to live (TTL), which is a numerical value that limits the time an IP packet can exist in a computer network. The maximum value of TTL is 255, and the recommended value is 64.

Although TTL literally means how long the packet can live, in reality, it is the number of routers an IP packet can pass through in a computer network. The TTL field is set by the sender of the IP packet, and the router modifies the value of the TTL field for each router the IP packet passes along its entire forwarding path from the source address to the destination address. This is done by subtracting 1 from the TTL value and then forwarding the IP packet. If the TTL decreases to 0 before the IP packet reaches the destination, the router will discard the received IP packet with TTL = 0 and send a message “ICMP time exceeded” to the sender of the IP packet.

The above-mentioned situation of packets continuing to be forwarded clockwise in the ring network is caused by the ring network’s use of default routes. Even if it is not a ring network, using default routes may cause packets to be forwarded back and forth on the link until the its TTL is reduced to 0.

As shown in Fig. 5.24, there are three network segments and two routers in the network. Add a default route to Router RA with the next hop to Router RB. Add a default route to Router RB as well, with the next hop to Router RA, thus enabling the network to flow smoothly between these three network segments.

Fig. 5.24
figure 24

Problems arising from default routing

There is no network segment 40.0.0.0/8 in this network. If Computer A pings the address 40.0.0.2, the packet will be forwarded to RA. RA forwards the packet to RB according to the default route. RB then forwards it to RA using the default route, and RA forwards it back to RB. The process continues until the TTL of the packet is reduced to 0, and the router discards the packet and sends a message “ICMP time exceeded” to the sender.

5.4.6 Default Routes and Gateways on Hosts

The previous sections introduce adding static routes to the router, but in fact hosts (Windows systems and Linux systems) also have routing tables. The routing table on the Windows system can be displayed by executing the route print command, and the same effect can be achieved by executing the netstat -r command.

As shown in Fig. 5.25, configuring a gateway to a computer means adding a default route to it, and a gateway is usually the address of the router interface on this network segment. If the gateway is not configured, the computer will not be able to communicate across the network segment as it will have no idea which is the next hop interface in order to get to the other network segments. If the computer’s local connection is not configured with a gateway, using the route add command to add a default route will work. As shown in Fig. 5.26, by removing the gateway from the local connection, and executing “netstat-r” at the command prompt to display the routing table, you can see that there is no default route.

Fig. 5.25
figure 25

A gateway equals a default route.

Fig. 5.26
figure 26

View the routing table

Execute “route /?” at the command prompt. You can see the help information of this command.

C:\Users\win7>route /? Manipulates network routing tables. UTE [-f] [-p] [-4|-6] command [destination]        [MASK netmask]  [gateway] [METRIC metric]  [IF interface] -f     Clears the routing tables of all gateway entries. If this is used in conjunction with one of the commands, the tables are cleared prior to running the command. -p     When used with the ADD command, makes a route persistent across boots of the system. By default, routes are not preserved when the system is restarted. Ignored for all other commands, which always affect the appropriate persistent routes. This option is not supported in Windows 95.。 -4     Forces IPv4。 -6     Forces IPv6。 command    One of these:            PRINT     Prints a route            ADD       Adds a route            DELETE    Deletes a route            CHANGE    Modifies an existing route destination    Specifies the host. MASK         Specifies that the next parameter is the ‘netmask’ value. netmask      Specifies a subnet mask value for this route entry. If not specified, it defaults to 255.255.255.255. gateway      Specifies gateway. interface    the interface number for the specified route. METRIC       Specifies the metric, ie. cost for the destination.

As shown in Fig. 5.27, enter “route add 0.0.0.0 mask 0.0.0.0 192.168.80.1 -p”. The parameter “-p” represents the addition of a permanent default route, that is, the default route still exists after the computer is restarted.

Fig. 5.27
figure 27

Add a default route

Think about it: under what circumstances would you add a route to the computer?

Here is an application scenario. As shown in Fig. 5.28, a company has deployed a Web server in a telecom server room. This Web server needs to access the database server, which is deployed on a separate network segment (intranet) for security purposes. The company deploys another router and a switch in the telecom server room and deploys the database server on the intranet.

Fig. 5.28
figure 28

A static route needs to be added.

There is no route added to the enterprise router and no route to the intranet to the telecom router (the key is that the network administrator in the telecom server room disagrees to add a route to the intranet either).

In this case, you need to add a default route to the Internet on the Web server, and then a route to the intranet, as shown in Fig. 5.29.

Fig. 5.29
figure 29

Add a static route and a default route

In this case, you shall never add two default routes on the Web server, one to 132.108.10.1 and the other to 132.108.10.254, or add two default gateways to the local connection. If you add two default routes, it is tantamount to having two equal-cost paths to the Internet, so that half of the traffic to the Internet will be sent to and dropped by the enterprise router.

If you want to delete the route to network segment “172.16.0.0 255.255.255.0”, you can execute the following command.

route delete 172.16.0.0 mask 255.255.255.0

5.5 Exercises

  1. 1.

    The configuration command for static routing of a Huawei router is ( ).

    1. A.

      ip route-static

    2. B.

      ip route

    3. C.

      route-static ip

    4. D.

      route ip

  2. 2.

    Suppose there are four routes: 170.18.129.0/24, 170.18.130.0/24, 170.18.132.0/24 and 170.18.133.0/24. If you perform route summarization, the address that can cover these four routes is ( ).

    1. A.

      170.18.128.0/21

    2. B.

      170.18.128.0/22

    3. C.

      170.18.130.0/22

    4. D.

      170.18.132.0/23

  3. 3.

    Suppose there are two routes: 21.1.193.0/24 and 21.1.194.0/24. If you perform route summarization, the address that can cover these two routes is ( ).

    1. A.

      21.1.200.0/22

    2. B.

      21.1.192.0/23

    3. C.

      21.1.192.0/22

    4. D.

      21.1.224.0/20

  4. 4.

    The router receives an IP packet whose destination address is 202.31.17.4, and the subnet matching this address is ( ).

    1. A.

      202.31.0.0/21

    2. B.

      202.31.16.0/20

    3. C.

      202.31.8.0/22

    4. D.

      202.31.20.0/22

  5. 5.

    Suppose there are two subnets: 210.103.133.0/24 and 210.103.130.0/24. If you perform route summarization, the network address you get is ( ).

    1. A.

      210.103.128.0/21

    2. B.

      210.103.128.0/22

    3. C.

      210.103.130.0/22

    4. D.

      210.103.132.0/20

  6. 6.

    Setting a default route in the routing table, the destination address and subnet mask should be ( ).

    1. A.

      127.0.0.0 255.0.0.0

    2. B.

      127.0.0.1 0.0.0.0

    3. C.

      1.0.0.0 255.255.255.255

    4. D.

      0.0.0.0 0.0.0.0

  7. 7.

    The network address you get after the route summarization of networks 122.21.136.0/24 and 122.21.143.0/24 is ( ).

    1. A.

      122.21.136.0/22

    2. B.

      122.21.136.0/21

    3. C.

      122.21.143.0/22

    4. D.

      122.21.128.0/24

  8. 8.

    The router receives a packet whose destination address is 195.26.17.4. This address belongs to the subnet ( ).

    1. A.

      195.26.0.0/21

    2. B.

      195.26.16.0/20

    3. C.

      195.26.8.0/22

    4. D.

      195.26.20.0/22

  9. 9.

    As shown in Fig. 5.30, the network segments connected to router R1 are summarized into a route 192.1.144.0/20 on router R2. Which packet will be forwarded to R1 by router R2 using this summarized route?

    1. A.

      192.1.159.2

    2. B.

      192.1.160.11

    3. C.

      192.1.138.41

    4. D.

      192.1.1.144

  10. 10.

    As shown in Fig. 5.31, you need to add routing tables to router A and router B to allow network segments A and B to access each other. Please fill in the corresponding content on the following horizontal lines.

    [RouterA]ip route-static ________________   ________________   ________________

    [RouterB]ip route-static ________________   ________________   ________________

  11. 11.

    As shown in Fig. 5.32, packets from network segment 192.168.1.0/24 to 192.168.2.0/24 are required to pass through R1 → R2 → R4; packets from network segment 192.168.2.0/24 to 192.168.1.0/24 are required to pass through R4 → R3 → R1. Now you need to add static routes to these four routers so that the network segments 192.168.1.0/24 and 192.168.2.0/24 can communicate with each other. Please fill in the appropriate content on the following horizontal line.

    [R1]ip route-static________________   ________________   ________________

    [R2] ip route-static________________   ________________   ________________

    [R3] ip route-static________________   ________________   ________________

    [R4]ip route-static________________   ________________   ________________

  12. 12.

    As shown in Fig. 5.33, execute the following commands on the router to add static routes

    [R1]ip route-static 0.0.0.0 0 192.168.1.1 [R1]ip route-static 10.1.0.0 255.255.0.0 192.168.3.3 [R1]ip route-static 10.1.0.0 255.255.255.0 192.168.2.2

    Match the destination IP addresses on the left side of Fig. 5.33 and the next hop addresses of the router on the right side.

  13. 13.

    Which of the following static route configuration is correct ( )?

    1. A.

      [R1]ip route-static 129.1.4.0 16 serial 0

    2. B.

      [R1]ip route-static 10.0.0.2 16 129.1.0.0

    3. C.

      [R1]ip route-static 129.1.0.0 16 10.0.0.2

    4. D.

      [R1]ip route-static 129.1.2.0 255.255.0.0 10.0.0.2

  14. 14.

    There is a TTL field in an IP message header, and which of the following statements about this field is correct ( )?

    1. A.

      The length of the field is seven bits

    2. B.

      The field is used for packet fragmentation

    3. C.

      The field is used for packet anti-loop

    4. D.

      The field is used to indicate the preference of the packet

  15. 15.

    When a router forwards a packet, if no corresponding detailed route is matched and there is no default route, it will directly discard the packet. Is this statement correct? ( )

    1. A.

      Correct

    2. B.

      Incorrect

  16. 16.

    Which of the following is not included in the routing table? ( )

    1. A.

      Source address

    2. B.

      Next hop

    3. C.

      Destination network

    4. D.

      Routing cost

  17. 17.

    Which of the following statements about static routing preference in Huawei devices is incorrect ( ).

    1. A.

      The value range of static route preference is between 0 to 65535

    2. B.

      The default value of static route preference is 60

    3. C.

      The preference of the static route can be specified

    4. D.

      The preference of 255 for a static route means that the route is not available

  18. 18.

    Which of the following statements about the TTL field in the IP message header is correct ( )?

    1. A.

      TTL defines the number of packets that the source host can send

    2. B.

      TTL defines the time interval between packets sent by the source host

    3. C.

      The TTL value is subtracted by 1 for each router an IP message passes through

    4. D.

      The TTL value of an IP message is increased by 1 for each router an IP message passes through

  19. 19.

    For the ip route-static 10.0.12.0 255.255.255.0 192.168.11 command, which of the following descriptions is correct ( )?

    1. A.

      This command configures a route to network 192.168.1.1

    2. B.

      This command configures a route to network 10.0.12.0/24

    3. C.

      The route has a preference of 100

    4. D.

      If the router learns a route to the same network as this route via another protocol, the router will give preference to this route

  20. 20.

    A router is known to have the following two entries in its routing table.

    Destination/Mask Proto Pre Cost NextHop Interface 9.0.0.0/8 OSPF 10 50 1.1.1.1 Serial0 9.1.0.0/16 RIP 100 5 2.2.2.2 Ethernet0

    If this router wants to forward a message whose destination address is 9.1.4.5, which of the following statements is correct ( )?

    1. A.

      The first entry is chosen as the best match because OSPF protocol has a higher preference

    2. B.

      The second entry is chosen as the best match because RIP protocol a has lower cost

    3. C.

      The second entry is chosen as the best match because the exit is Ethternet 0, which is faster than Serial 0

    4. D.

      The second entry is chosen as the best match because it is a more accurate match for destination address 9.1.4.5

  21. 21.

    Which of the following programs or commands can be used to probe the path taken by a data message from the source node to the destination node? ( )

    1. A.

      route

    2. B.

      netstat

    3. C.

      tracert

    4. D.

      send

  22. 22.

    As shown in Fig. 5.34, the intranet of a branch office is connected to the network of the head office. In order to access the Internet, the branch office also set up a branch office extranet. The address planning of the intranet and extranet of the branch is shown in Fig. 5.34. The computers in the branch office have two network cables, which are connected to the extranet of the branch office when accessing the Internet and to the intranet of the branch office when accessing the network of the head office. Now you need to plan the network of the branch office. How can the computers in the branch office access both the Internet and the network of the head office without switching networks?

Fig. 5.30
figure 30

Example network (1)

Fig. 5.31
figure 31

Example network (2)

Fig. 5.32
figure 32

Example network (3)

Fig. 5.33
figure 33

Match the destination IP addresses and next hop addresses

Fig. 5.34
figure 34

Head office network and branch office network