靜態路由是指手工配置的路由信息。
拓撲
網絡
R1 interface Ethernet0/0/0 ip address 192.168.10.1 255.255.255.0 interface Serial0/0/0 link-protocol ppp ip address 10.0.12.1 255.255.255.0 R2 interface Serial0/0/0 link-protocol ppp ip address 10.0.23.2 255.255.255.0 interface Serial0/0/1 link-protocol ppp ip address 10.0.12.2 255.255.255.0 R3 interface Ethernet0/0/0 ip address 192.168.20.1 255.255.255.0 interface Serial0/0/1 link-protocol ppp ip address 10.0.23.1 255.255.255.0
[r1]ip route-static 192.168.20.0 255.255.255.0 10.0.12.2 [r2]ip route-static 192.168.20.0 255.255.255.0 10.0.23.1 [r1]ip route-static 10.0.23.0 24 Serial 0/0/0 [r2]ip route-static 192.168.10.0 24 10.0.12.1 [r3]ip route-static 192.168.10.0 255.255.255.0 10.0.23.2 [r3]ip route-static 10.0.12.0 24 Serial 0/0/1
[r1]dis ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 9 Routes : 9 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.12.0/24 Direct 0 0 D 10.0.12.1 Serial0/0/0 10.0.12.1/32 Direct 0 0 D 127.0.0.1 Serial0/0/0 10.0.12.2/32 Direct 0 0 D 10.0.12.2 Serial0/0/0 10.0.23.0/24 Static 60 0 D 10.0.12.1 Serial0/0/0 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 192.168.10.0/24 Direct 0 0 D 192.168.10.1 Ethernet0/0/0 192.168.10.1/32 Direct 0 0 D 127.0.0.1 Ethernet0/0/0 192.168.20.0/24 Static 60 0 RD 10.0.12.2 Serial0/0/0
浮動靜態路由(Floating Static Route)是一種特殊的靜態路由,經過配置去往相同的目的網段,但優先級不一樣的靜態路由,以保證網絡中優先級較高的路由,即主路由失效的狀況下, 提供備份路由。正常狀況下,備份路由不會出如今路由表中。負載均衡
R1 interface Serial0/0/0 link-protocol ppp ip address 10.0.10.1 255.255.255.0 interface Serial0/0/1 link-protocol ppp ip address 10.0.12.1 255.255.255.0 interface GigabitEthernet0/0/0 ip address 192.168.10.1 255.255.255.0 R2 interface Serial0/0/0 link-protocol ppp ip address 10.0.10.2 255.255.255.0 interface Serial0/0/3 link-protocol ppp ip address 10.0.11.2 255.255.255.0 R3 interface Serial0/0/1 link-protocol ppp ip address 10.0.12.2 255.255.255.0 interface Serial0/0/2 link-protocol ppp ip address 10.0.11.1 255.255.255.0 interface GigabitEthernet0/0/0 ip address 192.168.20.1 255.255.255.0
[r1]ip route-static 192.168.20.0 24 Serial 0/0/1 [r2]ip route-static 192.168.10.0 24 Serial 0/0/0 [r2]ip route-static 192.168.20.0 24 Serial 0/0/1 [r3]ip route-static 192.168.10.0 24 Serial 0/0/1
[r1]ip route-static 192.168.20.0 24 10.0.10.2 preference 100 [r3]ip route-static 192.168.10.0 24 10.0.11.2 preference 100
[r1]dis 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.20.0/24 Static 60 0 D 10.0.12.1 Serial0/0/1 Static routing table status : <Inactive> Destinations : 1 Routes : 1 Destination/Mask Proto Pre Cost Flags NextHop Interface 192.168.20.0/24 Static 100 0 R 10.0.10.2 Serial0/0/0
負載均衡(Load sharing)能實現鏈路冗餘,數據分流,減輕單鏈路負載太重;經過配置優先級和開銷來實現ide
[r1]ip route-static 192.168.20.0 24 Serial 0/0/0 [r3]ip route-static 192.168.10.0 24 Serial 0/0/2
[r1]dis ip routing-table Route Flags: R - relay, D - download to fib ------------------------------------------------------------------------------ Routing Tables: Public Destinations : 11 Routes : 12 Destination/Mask Proto Pre Cost Flags NextHop Interface 10.0.10.0/24 Direct 0 0 D 10.0.10.1 Serial0/0/0 10.0.10.1/32 Direct 0 0 D 127.0.0.1 Serial0/0/0 10.0.10.2/32 Direct 0 0 D 10.0.10.2 Serial0/0/0 10.0.12.0/24 Direct 0 0 D 10.0.12.1 Serial0/0/1 10.0.12.1/32 Direct 0 0 D 127.0.0.1 Serial0/0/1 10.0.12.2/32 Direct 0 0 D 10.0.12.2 Serial0/0/1 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 192.168.10.0/24 Direct 0 0 D 192.168.10.1 GigabitEthernet 0/0/0 192.168.10.1/32 Direct 0 0 D 127.0.0.1 GigabitEthernet 0/0/0 192.168.20.0/24 Static 60 0 D 10.0.12.1 Serial0/0/1 Static 60 0 D 10.0.10.1 Serial0/0/0
參考HCNA網絡技術實驗指南oop