R1-R4各需要4个环回,然后路由器的每一个接口需要一个网段,则一共需要14个网段。
将172.16.0.0/16借4位然后进行子网划分,从划分出来的16个子网中拿14进行使用。
但是这样会出现一种弊端,在实际的配置过程当中,进行手工汇总的时候就会出现好多掩码不同的子网,当路由器查表按照最长匹配原则查表的时候可能导致出环的现象发生。
因为实际上在具体配置的时候,R1-R4这几个路由器上每两个环回路由都将被手工汇总为掩码相同的子网,才可以让每一个路由器都想通,所以我们可以先给每一个路由器配一个地址,然后再子网划分为两个子网掩码都相同的子网即可;同样,每一条干道(就是两路由器相连的)
r1#ping 172.16.0.18
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.18, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
r1#ping 172.16.0.18
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.18, timeout is 2 seconds:
.!!!!
Success rate is 80 percent (4/5), round-trip min/avg/max = 0/0/0 ms
r1#ping 172.16.0.22
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.22, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
r1#
r5#ping 172.16.32.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.32.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
r5#ping 172.16.48.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.48.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
r5#ping 172.16.64.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.64.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/1/3 ms
r5#ping 172.16.80.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.80.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
r5#ping 172.16.96.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.96.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
r5#ping 172.16.112.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.112.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
r5#ping 172.16.128.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.128.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
r5#ping 172.16.144.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.144.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
r5#ping 172.16.0.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/2 ms
r5#ping 172.16.0.5
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.5, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/2 ms
r5#ping 172.16.0.9
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.9, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/0 ms
r5#ping 172.16.0.13
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 172.16.0.13, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
r5#
r1#ping 1.1.1.1
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 1.1.1.1, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 0/0/1 ms
r1#
给每一个路由器配置自己的空接口防环就OK!
r1(config)#ip route 172.16.32.0 255.255.224.0 null ?
<0-0> Null interface number
r1(config)#ip route 172.16.32.0 255.255.224.0 null 0
r1(config)#
r2>en
r2#conf t
r2(config)#ip route 172.16.64.0 255.255.224.0 null 0
r2(config)#
r3>en
r3#conf t
r3(config)#ip route 172.16.96.0 255.255.224.0 null 0
r3(config)#
r4(config)#ip route 172.16.128.0 255.255.224.0 null 0
r4(config)#
其实我们前面手工配置的静态路由都可以省略,直接配缺省路由就可以通。