在《2010_8_17_静态路由_静态路由配置2》基础上增加一个新网段(C区),且地址是172.16.6.0(使得刚才发布好的172.16.0.0/21成为不连续的网段了)。配置静态和默认路由使A/B/C三区互通。
实验配置详解因此,虽然在R4中配置了一个汇总路由条目:
S 172.16.0.0/21 [1/0] via 192.168.1.1
但是,仍然可以配置一个更长的匹配:
S 172.16.6.0/24 is directly connected, Serial3/0
这样,凡是172.16.6.0的路由走Serial3/0,172.16.0.0的走192.168.1.1。
因此其它的配置都可以不变,只是在所有路由器上增加指向172.16.6.0/24的静态路由即可。
在新增的C区的路由器R8上配置如下:
ip route 192.168.0.0 255.255.254.0 Serial2/0
ip route 172.16.0.0 255.255.248.0 Serial2/0
不需要再单独声明一条指向172.16.6.0/24的静态路由,因为已经是直连端口了,查看路由表结果如下:
172.16.0.0/16 is variably subnetted, 2 subnets, 2 masks
S 172.16.0.0/21 is directly connected, Serial2/0
C 172.16.6.0/24 is directly connected, FastEthernet0/0
S 192.168.0.0/23 is directly connected, Serial2/0
C 192.168.2.0/24 is directly connected, Serial2/0
仍然按照最长路由匹配原则。
[G.W1]路由的最长匹配原则
转载于:https://blog.51cto.com/gabriel/377429