網關冗餘技術(HSRP、VRRP、GLBP)Sniffer
網關冗餘技術是大型網絡中不可缺少的技術,當網絡足夠大的時候,我們要考慮的不光是網絡本身的性能問題,冗餘技術也是必不可少的。
通過這個實驗詳細說明HSRP、VRRP、GLBP的配置以及它們的區別,並最後用sniffer 分析一下包結構。
網絡拓樸:
實驗任務:
l 分別用HSRP、VRRP、glbp實現網關冗餘
l Sniffer分析三種協議包結構
環境描述:
l 3臺Cisco3640 + NE-4E模塊,該配置擁有4個Ethernet
l 1臺 Cisco3640+NE-16ESW
l R3 Lo1、lo2、lo3、sniffer pc用來測試
地址分配:
設備名稱 | 接口 | IP地址 | 描述 |
R1 | E0/0 | 192.168.1.1/24 | TO SW-F0/0 |
E0/1 | 192.168.1.1/24 | TO R3-E0/1 | |
R2 | E0/0 | 192.168.1.2/24 | TO SW-F0/1 |
E0/1 | 192.168.3.2/24 | TO R3-E0/2 | |
R3 | E0/1 | 192.168.2.1/24 | TO R1-E0/1 |
E0/2 | 192.168.3.1/24 | TO R2-E0/1 | |
SW | F0/0 | - | TO R1-E0/0 |
F0/1 | - | TO R2-E0/0 | |
F0/10 | - | TO Sniffer | |
SNiffer | NIC | 192.168.20.20/24 | TO SW-F0/10 |
詳細配置:
1、IP地址設置
R1 (config) #int e0/0
R1 (config-if) #ip add 192.168.1.1 255.255.255.0
R1 (config-if) #no sh
R1 (config) #int e0/1
R1 (config-if) #ip add 192.168.2.2 255.255.255.0
R1 (config-if) #no sh
R2 (config) #int e0/0
R2 (config-if) #ip add 192.168.1.2 255.255.255.0
R2 (config-if) #no sh
R2 (config) #int e0/1
R2 (config-if) #ip add 192.168.3.2 255.255.255.0
R2 (config-if) #no sh
R3 (config) #int e0/1
R3 (config-if) #ip add 192.168.2.1 255.255.255.0
R3 (config-if) #no sh
R3 (config) #int e0/2
R3 (config-if) #ip add 192.168.3.1 255.255.255.0
R3 (config-if) #no sh
2、路由
R1 (config) #router ospf 1
R1 (config-router) #net 192.168.1.1 0.0.0.0 a 10
R1 (config-router) #net 192.168.2.2 0.0.0.0 a 0
R2 (config) #router ospf 1
R2 (config-router) #net 192.168.1.2 0.0.0.0 a 10
R2 (config-router) #net 192.168.3.2 0.0.0.0 a 0
R3 (config) #router ospf 1
R3 (config-router) #net 0.0.0.0 255.255.255.255 a 0
3、HSRP (Hot Standby Router Protocal)
R1(config-if)# int e0/0
R1(config-if)# standby 10 mac-address 0000.1111.2222
手動更改virtual address,缺省爲0000.0c07.acXX
R1(config-if)# standby 10 desciption test
描述
R1(config-if)# standby 10 ip 192.168.1.254
加入備份組10
R1(config-if)# standby 10 priority 200
設置優先級200,缺省爲100
R1(config-if)# standby 10 preempt
設置佔先權,缺點沒有啓用
R1(config-if)# standby 10 authentication md5 key-string zhaogang
設置認證,md5
R1(config-if)# standby 10 name zg
設置備份組名稱
R1(config-if)# standby 10 track Ethernet0/1 100
設置佔端口跟蹤e0/1
R2(config-if)# int e0/0
R2(config-if)# standby 10 mac-address 0000.1111.2222
R1(config-if)# standby 10 ip 192.168.1.254
R2(config-if)# standby 10 priority 200
R2(config-if)# standby 10 preempt
R2(config-if)# standby 10 authentication md5 key-string zhaogang
R2(config-if)# standby 10 name zg
R2(config-if)# standby 10 track Ethernet0/1 100
3、VRRP (Virtual Router Redundancy Protocol)
R1(config)# track 1 int e0/1 line-protocol
定義跟蹤組1,跟蹤int e0/1狀態
R1(config-if)# vrrp 1 description test
描述
R1(config-if)# vrrp 1 ip 192.168.1.254
加入備份組1
R1(config-if)# vrrp 1 timers advertise 2
設置通告時間
R1(config-if)# vrrp 1 timers learn
設置向master learn timer set
R1(config-if)# vrrp 1 priority 200
設置優先級200
R1(config-if)# vrrp 1 authentication md5 key-string zhaogang
設置認證md5類型
R1(config-if)# vrrp 1 track 1 decrement 100
跟蹤接口
R2(config)# track 1 int e0/1 line-protocol
R2(config-if)# vrrp 1 description test
R2(config-if)# vrrp 1 ip 192.168.1.254
R2(config-if)# vrrp 1 timers advertise 2
R2(config-if)# vrrp 1 timers learn
master learn timer set
R2(config-if)# vrrp 1 priority 150
R2(config-if)# vrrp 1 authentication md5 key-string zhaogang
R1(config-if)# vrrp 1 track 1 decrement 100
附相關截圖:
4、GLBP( Gateway Load Balance Protocol)
R1(config-if)# glbp 1 ip 192.168.1.254
R1(config-if)# glbp 1 priority 200
R1(config-if)# glbp 1 preempt delay minimum 1
設置搶佔的最小延遲1S
R1(config-if)# glbp 1 weighting 200 lower 120 up 200
設置GLBP 加權最大值200,門檻值最小120,最大200
當GLBP組成員加權值小於最小門檻值時,放棄AVF(活動轉發器)角色
R1(config-if)# glbp 1 weighting track 1 decrement 100
R1(config-if)# glbp 1 forwarder preempt delay minimum 2
轉發最小延遲2S
R2(config-if)# glbp 1 ip 192.168.1.254
R2(config-if)# glbp 1 priority 150
R2(config-if)# glbp 1 preempt delay minimum 1
設置搶佔的最小延遲1S
R2(config-if)# glbp 1 weighting 200 120 up 200
設置GLBP 加權最大值200,門檻值最小120,最大200
當GLBP組成員加權值小於最小門檻值時,放棄AVF(活動轉發器)角色
R2(config-if)# glbp 1 weighting track 1 decrement 100
R2(config-if)# glbp 1 forwarder preempt delay minimum 2
轉發最小延遲2S
附相關截圖:
Sniffer分析:
HSRP包結構
HSRP hello包 組播00105E000002 224.0.0.2
Virgin狀態
Speek狀態
Listen狀態
VRRP包結構
獨立協議,protocol:112 ,組播地址224.0.0.18
GLBP包結構
GLBP協議爲TCP封裝 source port 3222 destination
port 3222