構建高可用性網絡的方法有:
1.服務器羣集 包括LB:負載均衡羣集 HA:高可用性羣集
2.路由設備 HSRP :熱備份路由協議 VRRP:虛擬路由器冗餘協議
3.Linux 網絡接口綁定bond
4.局域網lan 內: stp rstp mstp
廣域網鏈路: 浮動的靜態路由 standby interface 鏈路捆綁
下面來分別介紹以上幾種構建高可用網絡的方法
一 服務器羣集
撰寫中……
二 路由設備VRRP && HSRP
歡迎訪問我的另一篇博文,裏面有詳細的講解:
三 Linux 網絡接口綁定bond
歡迎訪問我的另一篇博文,裏面有詳細的講解:
四 局域網lan 內: stp rstp mstp
五 廣域網鏈路: 浮動的靜態路由 standby interface 鏈路捆綁
案例一:浮動的靜態路由
案例說明:總公司內網主機爲Pc1,分公司內網主機爲PC2,現在爲了安全使用兩種方式進行通信:通過廣域網使用電信服務提供商的網絡和使用ISDN/PSTN 撥號網絡。由於撥號網絡的帶寬較低,在華爲路由器中,ospf的優先級爲10高於靜態路由優先級60,所以撥號網絡使用靜態路由,而DDN/SDH網絡使用ospf路由協議。這樣默認情況下將會有限使用DDN/SDH網絡。
拓撲圖:
配置步驟:
R6
[R6]interface ethernet 0 ##進入與PC1相連的接口
[R6-Ethernet0]ip address 192.168.1.254 ##爲接口配置ip 地址
[R6]interface serial 0 ##進入廣域網鏈路接口
[R6-Serial0]ip address 192.168.3.1 24 ##爲接口配置ip 地址
[R6]interface serial 1 ##進入ISDN/pstn鏈路接口
[R6-Serial1]ip address 192.168.4.1 24 ##爲接口配置ip 地址
[R6]ospf enable ##全局開啓ospf協議
[R6-ospf]interface ethernet 0 ##進入接口ethernet 0 ,開啓ospf功能
[R6-Ethernet0]ospf enable area 0 ##將該接口加入區域0
[R6]interface serial 0 ##進入接口serial 0,開啓ospf功能
[R6-Serial0]ospf enable area 0 ##將該接口加入區域0
[R6]ip route-static 192.168.2.0 24 192.168.4.2 ##配置到達2.0 網段靜態路由
R10
[R10]interface ethernet 0 ##進入與PC2相連的接口
[R10-Ethernet0]ip address 192.168.2.254 24 ##爲接口配置ip 地址
[R10]interface serial 0 ##進入廣域網鏈路接口
[R10-Serial0]ip address 192.168.3.2 24 ##爲接口配置ip 地址
[R10]int serial 1 ##進入ISDN/pstn鏈路接口
[R10-Serial1]ip address 192.168.4.2 24 ##爲接口配置ip 地址
[R10]ospf enable ##全局開啓ospf協議
[R10]interface ethernet 0 ##進入接口ethernet 0 ,開啓ospf功能
[R10-Ethernet0]ospf enable area 0 ##將該接口加入區域0
[R10-Ethernet0]int ser 0 ##進入接口serial 0,開啓ospf功能
[R10-Serial0]ospf enable area 0 ##將該接口加入區域0
[R10]ip route-static 192.168.1.0 24 192.168.4.1 ##配置到達1.0 網段靜態路由
測試結果:
由於ospf的優先級爲10 ,靜態路由的優先級爲60,所以這裏只看到ospf的路由表
[R6]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.0/24 OSPF 10 1572 192.168.3.2 Serial0
192.168.3.0/24 Direct 0 0 192.168.3.2 Serial0
192.168.3.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.2/32 Direct 0 0 192.168.3.2 Serial0
192.168.4.0/24 Direct 0 0 192.168.4.2 Serial1
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial1
斷開R6的serial0 口後,查看R6路由器的路由表
[R6]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.0/24 Static 60 0 192.168.4.2 Serial1
192.168.4.0/24 Direct 0 0 192.168.4.2 Serial1
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial1
由於ospf的優先級爲10 ,靜態路由的優先級爲60,所以這裏只看到ospf的路由表
[R10]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 OSPF 10 1572 192.168.3.1 Serial0
192.168.2.0/24 Direct 0 0 192.168.2.254 Ethernet0
192.168.2.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.0/24 Direct 0 0 192.168.3.1 Serial0
192.168.3.1/32 Direct 0 0 192.168.3.1 Serial0
192.168.3.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.0/24 Direct 0 0 192.168.4.1 Serial1
192.168.4.1/32 Direct 0 0 192.168.4.1 Serial1
192.168.4.2/32 Direct 0 0 127.0.0.1 LoopBack0
斷開R6的serial0 口後,查看R6路由器的路由表
[R10]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Static 60 0 192.168.4.1 Serial1
192.168.2.0/24 Direct 0 0 192.168.2.254 Ethernet0
192.168.2.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.0/24 Direct 0 0 192.168.4.1 Serial1
192.168.4.1/32 Direct 0 0 192.168.4.1 Serial1
192.168.4.2/32 Direct 0 0 127.0.0.1 LoopBack0
默認走廣域網鏈路(ospf優先級高爲10)
斷掉R6 的s0口
案例二:standby interface
案例說明:
總公司內網主機爲Pc1,分公司內網主機爲PC2,現在爲了安全使用備份鏈路進行通信,使同一時刻只有一條鏈路聯通。
配置步驟:
R6
[R6]interface serial 0 ##進入廣域網鏈路接口
[R6-Serial0]ip address 192.168.3.1 24 ##爲接口配置ip 地址
[R6]interface serial 1 ##進入廣域網鏈路接口
[R6-Serial1]ip address 192.168.4.1 24 ##爲接口配置ip 地址
[R6]ip route-static 192.168.2.0 24 192.168.4.2 ##配置到達2.0 網段靜態路由
[R6]ip route-static 192.168.2.0 24 192.168.3.2 ##配置到達2.0 網段靜態路由
查看路由表:
[R6]dis ip routing
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.0/24 Static 60 0 192.168.3.2 Serial0
192.168.4.2 Serial1
192.168.3.0/24 Direct 0 0 192.168.3.2 Serial0
192.168.3.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.2/32 Direct 0 0 192.168.3.2 Serial0
192.168.4.0/24 Direct 0 0 192.168.4.2 Serial1
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial1
[R6]interface serial 0 ## 進入幹路接口
[R6-Serial0]standby interface serial 1 ##配置幹路接口的備份接口
[R6-Serial0]standby timer enable-delay 10 ##如果幹路接口或鏈路故障,10s後切換到備份鏈路
[R6-Serial0]standby timer disable-delay 10 ##如果幹路恢復故障,10s後從備份鏈路切換到幹路
R10
[R10]interface ethernet 0 ##進入與PC1相連的接口
[R10-Ethernet0]ip address 192.168.2.254 24 ##爲接口配置ip 地址
[R10]interface serial 0 ##進入廣域網鏈路接口
[R10-Serial0]ip address 192.168.3.2 24##爲接口配置ip 地址
[R10]int serial 1 ##進入廣域網鏈路接口
[R10-Serial1]ip address 192.168.4.2 24 ##爲接口配置ip 地址
[R10]ip route-static 192.168.1.0 24 192.168.4.1 ##配置到達1.0 網段靜態路由
[R10]ip route-static 192.168.1.0 24 192.168.3.1 ##配置到達1.0 網段靜態路由
查看路由表:
[R10]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Static 60 0 192.168.3.1 Serial0
192.168.4.1 Serial1
192.168.2.0/24 Direct 0 0 192.168.2.254 Ethernet0
192.168.2.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.3.0/24 Direct 0 0 192.168.3.1 Serial0
192.168.3.1/32 Direct 0 0 192.168.3.1 Serial0
192.168.3.2/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.0/24 Direct 0 0 192.168.4.1 Serial1
192.168.4.1/32 Direct 0 0 192.168.4.1 Serial1
192.168.4.2/32 Direct 0 0 127.0.0.1 LoopBack0
[R10]int ser 0 ## 進入幹路接口
[R10-Serial0]standby inter serial 1 ##配置幹路接口的備份接口
[R10-Serial0]standby timer enable-delay 10 ##如果幹路接口或鏈路故障,10s後切換到備份鏈路
[R10-Serial0]standby timer disable-delay 10 ##如果幹路恢復故障,10s後從備份鏈路切換到幹路
結果測試:
R6 的s0接口關閉後
[R6]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.0/24 Static 60 0 192.168.4.2 Serial1
192.168.4.0/24 Direct 0 0 192.168.4.2 Serial1
192.168.4.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.4.2/32 Direct 0 0 192.168.4.2 Serial1
關閉R6的S0 口後
重新開啓R6的S0
案例三:鏈路捆綁
案例說明:
總公司內網主機爲Pc1,分公司內網主機爲PC2,現在爲了增加帶寬使用雙鏈路捆綁,將捆綁的鏈路虛擬出一條虛擬鏈路,通過該虛擬鏈路進行數據傳輸。
拓撲圖:
配置步驟:
R6:
[R6]interface virtual-template 1 ##創建虛擬接口模版1
[R6-Virtual-Template1]ip address 192.168.6.1 24 ##爲虛擬接口配置ip 地址
[R6]interface serial 0 ##進入廣域網接口
[R6-Serial0]ppp mp ##開啓多鏈路綁定
[R6-Serial0]ppp mp interface virtual-template 1 ##將該接口加入虛擬接口1
[R6]interface serial 1 ##進入廣域網接口
[R6-Serial1]ppp mp ##開啓多鏈路綁定
[R6-Serial1]ppp mp interface virtual-template 1 ##將該接口加入虛擬接口1
[R6]ip route-static 192.168.2.0 24 192.168.6.2 ##配置到達2.0網段的靜態路由
R10:
[R10]int virtual-t 1##創建虛擬接口模版1
[R10-Virtual-Template1]ip add 192.168.6.2 24 ##爲虛擬接口配置ip 地址
[R10]int ser 0 ##進入廣域網接口
[R10-Serial0]ppp mp ##開啓多鏈路綁定
[R10-Serial0]ppp mp interface virtual-template 1 ##將該接口加入虛擬接口1
[R10]int ser 1 ##進入廣域網接口
[R10-Serial1]ppp mp ##開啓多鏈路綁定
[R10-Serial1]ppp mp interface virtual-template 1 ##將該接口加入虛擬接口1
[R10]ip route-static 192.168.1.0 24 192.168.6.1#配置到達2.0網段的靜態路由
配置測試:
查看R6的路由表:
[R6]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Direct 0 0 192.168.1.254 Ethernet0
192.168.1.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.2.0/24 Static 60 0 192.168.6.2 Virtual-Template1
192.168.6.0/24 Direct 0 0 192.168.6.1 Virtual-Template1
192.168.6.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.6.2/32 Direct 0 0 192.168.6.1 Virtual-Template1
[R6]ping 192.168.2.200
PING 192.168.2.200: 56 data bytes, press CTRL_C to break
Reply from 192.168.2.200: bytes=56 Sequence=0 ttl=254 time = 35 ms
Reply from 192.168.2.200: bytes=56 Sequence=1 ttl=254 time = 29 ms
Reply from 192.168.2.200: bytes=56 Sequence=2 ttl=254 time = 29 ms
Reply from 192.168.2.200: bytes=56 Sequence=3 ttl=254 time = 28 ms
Reply from 192.168.2.200: bytes=56 Sequence=4 ttl=254 time = 31 ms
--- 192.168.2.200 ping statistics ---
5 packets transmitted
5 packets received
0.00% packet loss
round-trip min/avg/max = 28/30/35 ms
查看R10的路由表:
[R10]dis ip rou
Routing Tables:
Destination/Mask Proto Pref Metric Nexthop Interface
127.0.0.0/8 Direct 0 0 127.0.0.1 LoopBack0
127.0.0.1/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.1.0/24 Static 60 0 192.168.6.1 Virtual-Template1
192.168.2.0/24 Direct 0 0 192.168.2.254 Ethernet0
192.168.2.254/32 Direct 0 0 127.0.0.1 LoopBack0
192.168.6.0/24 Direct 0 0 192.168.6.2 Virtual-Template1
192.168.6.1/32 Direct 0 0 192.168.6.2 Virtual-Template1
192.168.6.2/32 Direct 0 0 127.0.0.1 LoopBack0
總部主機PC1可以連通分部Pc2
從PC1到PC2 從虛擬接口通過
DDN:
SDH:
ISDN:
PSTN: