实验原理图
实验要求:
1,R1-R4每台设备存在两个环回接口;
2,除R5环回的IP地址已经固定外;其余所有网段均基于192.168.1.0/24规划
3,在R1 - R4上不得直接配置到达5.5.5.0/24的路由条目;
4,减少路由条目的数量,避免环路,且全网可达
5,R 4 - R5间正常基于百米,故障时基于10米链路
如图6所示,基于静态的路由控制策略
实验配置:
R1路由器:
interface Loopback0
ip address 192.168.1.33 255.255.255.240
interface Loopback1
ip address 192.168.1.49 255.255.255.240
interface FastEthernet0/0
ip address 192.168.1.1 255.255.255.252
interface FastEthernet0/1
ip address 192.168.1.5 255.255.255.252
ip route 0.0.0.0 0.0.0.0 192.168.1.6
ip route 192.168.1.32 255.255.255.224 192.168.1.2
ip route 192.168.1.4 255.255.255.252 192.168.1.2
ip route 192.168.1.96 255.255.255.224 192.168.1.2
ip route 192.168.1.96 255.255.255.224 192.168.1.6
ip route 192.168.1.64 255.255.255.224 Null0
R2路由器:
interface Loopback0
ip address 192.168.1.65 255.255.255.240
interface Loopback1
ip address 192.168.1.81 255.255.255.240
interface FastEthernet0/0
ip address 192.168.1.2 255.255.255.252
interface FastEthernet0/1
ip address 192.168.1.9 255.255.255.252
duplex auto
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.1.10
ip route 192.168.1.32 255.255.255.224 192.168.1.1
ip route 192.168.1.4 255.255.255.252 192.168.1.1
ip route 192.168.1.96 255.255.255.224 192.168.1.1
ip route 192.168.1.96 255.255.255.224 192.168.1.10
ip route 192.168.1.64 255.255.255.224 Null0
R3路由器:
interface Loopback0
ip address 192.168.1.97 255.255.255.240
interface Loopback1
ip address 192.168.1.113 255.255.255.240
interface FastEthernet0/0
ip address 192.168.1.6 255.255.255.252
interface FastEthernet0/1
ip address 192.168.1.13 255.255.255.252
ip route 0.0.0.0 0.0.0.0 192.168.1.14
ip route 192.168.1.32 255.255.255.224 192.168.1.5
ip route 192.168.1.0 255.255.255.252 192.168.1.5
ip route 192.168.1.32 255.255.255.224 192.168.1.14
ip route 192.168.1.96 255.255.255.224 Null0
R4路由器:
interface Loopback0
ip address 192.168.1.129 255.255.255.240
interface Loopback1
ip address 192.168.1.145 255.255.255.240
interface FastEthernet0/0
ip address 192.168.1.10 255.255.255.252
interface FastEthernet0/1
ip address 192.168.1.14 255.255.255.252
interface FastEthernet1/0
ip address 192.168.1.17 255.255.255.252
interface FastEthernet1/1
ip address 192.168.1.21 255.255.255.252
ip classless
ip route 0.0.0.0 0.0.0.0 192.168.1.18
ip route 192.168.1.32 255.255.255.224 192.168.1.9
ip route 192.168.1.0 255.255.255.252 192.168.1.9
ip route 192.168.1.96 255.255.255.224 192.168.1.13
ip route 192.168.1.4 255.255.255.252 192.168.1.13
ip route 192.168.1.32 255.255.255.224 192.168.1.13
ip route 192.168.1.128 255.255.255.224 Null0
ip route 0.0.0.0 0.0.0.0 192.168.1.22 2
R5路由器:
interface Loopback0
ip address 5.5.5.5 255.255.255.0
interface FastEthernet0/0
ip address 192.168.1.18 255.255.255.252
interface FastEthernet0/1
ip address 192.168.1.22 255.255.255.252
ip route 192.168.1.0 255.255.255.252 192.168.1.17
ip route 192.168.1.4 255.255.255.252 192.168.1.17
ip route 192.168.1.8 255.255.255.252 192.168.1.17
ip route 192.168.1.12 255.255.255.252 192.168.1.17
ip route 192.168.1.32 255.255.255.224 192.168.1.17
ip route 192.168.1.64 255.255.255.224 192.168.1.17
ip route 192.168.1.96 255.255.255.224 192.168.1.17
ip route 192.168.1.128 255.255.255.224 192.168.1.17
ip route 192.168.1.0 255.255.255.252 192.168.1.21 2
ip route 192.168.1.4 255.255.255.252 192.168.1.21 2
ip route 192.168.1.8 255.255.255.252 192.168.1.21 2
ip route 192.168.1.12 255.255.255.252 192.168.1.21 2
ip route 192.168.1.32 255.255.255.224 192.168.1.21 2
ip route 192.168.1.64 255.255.255.224 192.168.1.21 2
ip route 192.168.1.96 255.255.255.224 192.168.1.21 2
ip route 192.168.1.128 255.255.255.224 192.168.1.21 2
实验结果检查:
正常情况下:
r5#traceroute 192.168.1.33
Type escape sequence to abort.
Tracing the route to 192.168.1.33
1 192.168.1.17 1 msec 0 msec 0 msec
2 192.168.1.9 1 msec 0 msec 0 msec
3 192.168.1.5 0 msec 0 msec 0 msec
当主路由宕掉的时候:
r5#traceroute 192.168.1.33
Type escape sequence to abort.
Tracing the route to 192.168.1.33
1 192.168.1.21 1 msec 0 msec 0 msec
2 192.168.1.13 0 msec 0 msec 0 msec
3 192.168.1.1 0 msec 1 msec 0 msec
实验总结:
静态路由需要仔细规划IP地址,避免手写静态路由过多,导致路由策略配置出错。
静态路由做备份的时候,可以在路由后面加上度量值,该值范围是1〜255。