靜態路由與IP SLA 路由聯動實現線路故障自動切換
一、組網需求
1、 單位需要與外聯單位網絡互通
2、 為了冗餘網絡,單位向運營商租用兩條專線與外聯單位互連
3、 兩條專線線路為主備模式,主R1--R2,當主線路故障自動切換到R1-R3(走S2)
4、 兩個單位內部各自運行OSPF
5、 不管哪條線路故障,自動切換網絡都不中斷
二、實驗清單和拓撲圖
1、路由器4臺;三層交換機1臺;兩臺二層交換機模擬運營商設備,PC機1臺。
2、IP地址說明:
R1與R2之間使用12.1.1.0/24 R1的地址12.1.1.1/24,R2的地址12.1.1.2/24
R1與SW8之間用18.1.1.0/24, R1的地址18.1.1.1/24,SW8的地址18.1.1.8/24
依次類推一樣
3、拓撲圖
三、配置步驟
3.1.1配置各接口的IP地址和OSPF配置
R1
interface FastEthernet0/0
ip address 18.1.1.1 255.255.255.0
interface FastEthernet0/1
ip address 12.1.1.1 255.255.255.0
router ospf 10
network 18.1.1.0 0.0.0.255 area 0
-----------------------------------------------------
R2
interface FastEthernet0/0
ip address 24.1.1.2 255.255.255.0
interface FastEthernet0/1
ip address 12.1.1.2 255.255.255.0
router ospf 110
network 24.1.1.0 0.0.0.255 area 0
-----------------------------------------------------
R3
interface FastEthernet0/0
ip address 13.1.1.3 255.255.255.0
interface FastEthernet0/1
ip address 34.1.1.3 255.255.255.0
router ospf 110
network 34.1.1.0 0.0.0.255 area 0
-----------------------------------------------------
R4
interface Loopback0
ip address 4.4.4.4 255.255.255.0
interface FastEthernet0/0
ip address 24.1.1.4 255.255.255.0
interface FastEthernet0/1
ip address 34.1.1.4 255.255.255.0
router ospf 110
network 4.4.4.0 0.0.0.255 area 0
network 24.1.1.0 0.0.0.255 area 0
network 34.1.1.0 0.0.0.255 area 0
-----------------------------------------------------
SW8
Vlan 10
interface Vlan10
ip address 192.168.1.1 255.255.255.0
interface FastEthernet0/0
ip address 18.1.1.8 255.255.255.0
router ospf 10
network 18.1.1.0 0.0.0.255 area 0
network 192.168.1.0 0.0.0.255 area 0
PC1
IP 192.168.1.10/24 GW:192.168.1.1
3.1.2 查看OSPF鄰居關係和路由
R1
R2
R3
R4
SW8
3.1.3 配置IP SLA及track
R1
ip sla 1
icmp-echo 12.1.1.2 source-ip 12.1.1.1 //IP地址去ping其直連網關IP地址
frequency 5 //ping的時間間隔為5秒鐘一次
ip sla schedule 1 life forever start-time now //計劃調度時間為從現在開始的每一天
track 1 rtr 1 reachability //追蹤去往是否可達性
R2
ip sla 1
icmp-echo 12.1.1.1 source-ip 12.1.1.2
frequency 5
ip sla schedule 1 life forever start-time now
track 1 rtr 1 reachability
3.1.4 配置靜態路由關聯track
R1
ip route 4.4.4.0 255.255.255.0 12.1.1.2 track 1
ip route 4.4.4.0 255.255.255.0 13.1.1.3 10 //不需要加track,要把metric修改大於1(靜態路由管理距離)
R2
ip route 192.168.1.0 255.255.255.0 12.1.1.1 track 1
R3
ip route 192.168.1.0 255.255.255.0 13.1.1.1 //不需要加track
3.1.6 靜態路由重分佈到OSPF
R1
router ospf 10
redistribute static subnets
R2
router ospf 110
redistribute static subnets
R3
router ospf 110
redistribute static metric 30 subnets //這裡要把重分佈的metric大於R2的metric
四、驗證配置結果
4.1 查看R1和R4的路由,線路正常是走S1
R1
當接口都是up的時,去往4.4.4.0/24的路由從R2出去
R4
當接口都是up的時,去往192.168.1.0/24的路由從R2出去,用源地址4.4.4.4 ping 192.168.1.10能通
4.1 當R1-R2線路故障時路由走R1-R3線路
4.1.1當R1端故障
R1
R2
R4
PC1
4.1.2當R2端故障
R2
R1
R4
PC1
說明:歡迎私聊,一起成長。
閱讀更多 攻城獅黑哥 的文章