静态路由
R1:
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.12.1 24
[R1-GigabitEthernet0/0/0]q
[R1]ip route-static 192.168.23.0 24 192.168.12.2
R2:
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 192.168.12.2 24
[R2-GigabitEthernet0/0/0]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 192.168.23.2 24
R3:
[R3]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.23.3 24
[R3-GigabitEthernet0/0/1]q
[R3]ip route-static 192.168.12.0 24 192.168.23.2
路由汇总
R1:
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.0.12.1 24
R2:
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.0.12.2 24
[R2-GigabitEthernet0/0/0]q
[R2]int LoopBack 0
[R2-LoopBack0]ip add 6.6.6.1 24
[R2-LoopBack0]ip add 6.6.4.1 24
R1:
[R1]ip route-static 6.6.4.0 22 10.0.12.2
浮动路由
是一种特殊的静态路由,通过配置去往相同的目的网段,但优先级不同的静态路由,保证在网络中优先级较高的路由,即主路由失效的情况下,提供备份路由。
R1:
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 192.168.10.2 24
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.0.12.1 24
[R1-GigabitEthernet0/0/1]int g 0/0/2
[R1-GigabitEthernet0/0/2]ip add 10.0.13.1 24
[R1]ip route-static 192.168.20.0 24 10.0.13.3
[R1]ip route-static 192.168.20.0 24 10.0.12.2 preference 100
R2:
[R2]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 10.0.12.2 24
[R2-GigabitEthernet0/0/1]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.0.23.2 24
[R2]ip route-static 192.168.20.0 24 10.0.23.3
[R2]ip route-static 192.168.10.0 24 10.0.12.1
R3:
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 10.0.23.3 24
[R3-GigabitEthernet0/0/0]int g 0/0/2
[R3-GigabitEthernet0/0/2]ip add 10.0.13.3 24
[R3-GigabitEthernet0/0/2]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 192.168.20.2 24
[R3]ip route-static 192.168.10.0 24 10.0.13.1
[R3]ip route-static 192.168.10.0 24 10.0.23.2
负载均衡
R1:
R1]int g 0/0/2
[R1-GigabitEthernet0/0/2]ip add 192.168.1.254 24
[R1-GigabitEthernet0/0/2]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 10.0.12.1 24
[R1-GigabitEthernet0/0/0]int g 0/0/1
[R1-GigabitEthernet0/0/1]ip add 10.0.13.1 24
[R1]ip route-static 192.168.2.0 24 10.0.12.2
[R1]ip route-static 192.168.2.0 24 10.0.13.3
R2:
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 10.0.12.2 24
R2-GigabitEthernet0/0/0]int g 0/0/1
[R2-GigabitEthernet0/0/1]ip add 10.0.24.2 24
[R2]ip route-static 192.168.2.0 24 10.0.24.4
[R2]ip route-static 192.168.1.0 24 10.0.12.1
R3:
[R3]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 10.0.13.3 24
[R3-GigabitEthernet0/0/1]int g 0/0/2
[R3-GigabitEthernet0/0/2]ip add 10.0.34.3 24
[R3]ip route-static 192.168.2.0 24 10.0.34.4
[R3]ip route-static 192.168.1.0 24 10.0.13.1
R4:
[R4]int g 0/0/1
[R4-GigabitEthernet0/0/1]ip add 10.0.24.4 24
[R4-GigabitEthernet0/0/1]int g 0/0/2
[R4-GigabitEthernet0/0/2]ip add 10.0.34.4 24
[R4-GigabitEthernet0/0/2]int g 0/0/0
[R4-GigabitEthernet0/0/0]ip add 192.168.2.254 24
[R4]ip route-static 192.168.1.0 24 10.0.24.2
[R4]ip route-static 192.168.1.0 24 10.0.34.3
路由黑洞
R1:
[R1]int g 0/0/0
[R1-GigabitEthernet0/0/0]ip add 13.1.1.1 24
[R1]int LoopBack 0
[R1-LoopBack0]ip add 10.1.1.1 24
[R1]ip route-static 10.1.0.0 24 13.1.1.3
[R1]ip route-static 34.1.1.0 24 13.1.1.3
R2:
[R2]int g 0/0/0
[R2-GigabitEthernet0/0/0]ip add 23.1.1.2 24
[R2]int LoopBack 0
[R2-LoopBack0]ip add 10.1.2.1 24
[R2]ip route-static 10.1.0.0 24 23.1.1.1
[R2]ip route-static 34.1.1.0 24 23.1.1.1
R3:
[R3]int g 0/0/0
[R3-GigabitEthernet0/0/0]ip add 13.1.1.3 24
[R3-GigabitEthernet0/0/0]int g 0/0/1
[R3-GigabitEthernet0/0/1]ip add 23.1.1.3 24
[R3-GigabitEthernet0/0/1]int g 0/0/2
[R3-GigabitEthernet0/0/2]ip add 34.1.1.3 24
[R3]ip route-static 0.0.0.0 0.0.0.0 34.1.1.4
[R3]ip route-static 10.1.0.0 24 34.1.1.4
[R3]ip route-static 10.1.1.0 24 13.1.1.1
[R3]ip route-static 10.1.2.0 24 23.1.1.2
[R3]ip route-static 10.1.0.0 16 NULL 0
R4:
[R4]int g 0/0/2
[R4-GigabitEthernet0/0/2]ip add 34.1.1.4 24
[R4]int LoopBack 0
[R4-LoopBack0]ip add 10.1.0.1 24