您的位置:首页 > 编程语言 > PHP开发

hsrp vrrp

2009-08-22 17:21 134 查看
Switch1 F0/12 <----> Switch4 F0/12
Switch1 F0/10 <----> Switch3 F0/10
Switch1 F0/14 <----> Switch2 F0/14
Switch4 F0/15 <----> Switch3 F0/15
Switch3 F0/12 <----> Switch2 F0/12
Switch2 F0/1 <----> Router1 F0/1
Switch2 F0/2 <----> Router2 F0/2
此实验源自net527的中级视频里面的HSRP章节。
首先配置下层设备。

R1:
no ip routing
int fa 0/1
no sw
ip addr 192.168.1.1 255.255.255.0
no shut
exit
ip defalut-gateway 192.168.1.254
R2:
no ip routing
inter fa 0/2
no sw
ip addr 192.168.2.2 255.255.255.0
no shut
exit
ip default-gateway 192.168.2.254
SW1:
配置vtp
vlan database
vtp server
vtp domain hsrp
vtp pruning
SW2,sw3
vlan database
vtp server
vtp domain hsrp
vtp pruning
SW2:
int fa 0/14
switchport mode trunk
no shu
inter fa 0/12
swit mode trunk
SW1:
interface fa 0/14
switchport mode trunk
no shut
SW3:
inter fa 0/12
swit mode trunk
no shut
SW1:
interface fa 0/10
switch mode trunk
no shut
SW3:
interface fa 0/10
switchport mode trunk
no shut
SW1,SW3
interface vlan 12
ip addr 192.168.1.251 192.168.1.253
no shut
SW1:
inter vlan 12
standby 12 ip 192.168.1.254 配置虚拟IP。
standby 12 preempt 150 配置优先级
standby 12 track fa 0/12 60 配置跟踪端口,当12挂了时,优先级为150-60
standby 12 preempt delay minium 50 配置当优先级恢复时,延迟50毫秒后再抢回Active状态。
此时并为将SW2的端口划分到任何vlan中。
SW1#show standby brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Vl12 12 150 P Active local 192.168.1.253 192.168.1.254

SW3#show standby brief
P indicates configured to preempt.
|
Interface Grp Prio P State Active Standby Virtual IP
Vl12 12 100 Standby 192.168.1.251 local 192.168.1.254
SW3#
SW1和SW3已经分别认出了对方,确定了各自的状态。
昨天net527群里的一个白痴说vlan里面必须有端口才能通讯。郁闷。

SW3#show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.253 - cc00.0ab0.0000 ARPA Vlan12
SW1#show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.1.251 - cc00.0350.0000 ARPA Vlan12
Internet 192.168.1.254 - 0000.0c07.ac0c ARPA Vlan12
因为SW1为ACTIVE状态,可以看到他监听1.251的MCA地址为0000.0c07.ac的MAC。
SW1#show standby
Vlan12 - Group 12
State is Active 当前状态
2 state changes, last state change 00:08:10
Virtual IP address is 192.168.1.254 虚拟IP。
Active virtual MAC address is 0000.0c07.ac0c 虚拟MAC。
Local virtual MAC address is 0000.0c07.ac0c (v1 default)
Hello time 3 sec, hold time 10 sec hello hold time
Next hello sent in 1.620 secs
Preemption enabled, delay min 50 secs
Active router is local 当前状态。
Standby router is 192.168.1.253, priority 100 (expires in 7.744 sec) standby IP.
Priority 150 (configured 150) 当前优先级,配置的优先级。
Track interface FastEthernet0/12 state Up decrement 60 跟踪的端口。
IP redundancy name is "hsrp-Vl12-12" (default)
SW1#
SW1#show standby vlan 12
Vlan12 - Group 12
State is Active
2 state changes, last state change 00:15:26
Virtual IP address is 192.168.1.254
Active virtual MAC address is 0000.0c07.ac0c
Local virtual MAC address is 0000.0c07.ac0c (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.316 secs
Preemption enabled, delay min 50 secs
Active router is local
Standby router is 192.168.1.253, priority 100 (expires in 9.456 sec)
Priority 150 (configured 150)
Track interface FastEthernet0/12 state Up decrement 60
IP redundancy name is "hsrp-Vl12-12" (default)

SW3: vrrp
config# track 1 interface fast 0/15 line-protocol 定义vrrp的track值。
interface vlan 22
ip addr 192.168.2.253 255.255.255.0
no shut
vrrp 22 ip 192.168.2.254
vrrp 22 track 1 decrement 60 定义接口D掉后的衰减值。
vrrp 22 priority 150
vrrp 22 preempt
SW1:
inter vlan 22
ip addr 192.168.2.251 255.255.255.0
no shut
vrrp 22 ip 192.168.2.254
SW1#show vrrp brief
Interface Grp Pri Time Own Pre State Master addr Group addr
Vl22 22 100 3609 Y Backup 192.168.2.253 192.168.2.254
SW1#
当前state backup
SW1#show vrrp interface vlan 22
Vlan22 - Group 22
State is Backup
Virtual IP address is 192.168.2.254
Virtual MAC address is 0000.5e00.0116
Advertisement interval is 1.000 sec
Preemption enabled
Priority is 100
Master Router is 192.168.2.253, priority is 150
Master Advertisement interval is 1.000 sec
Master Down interval is 3.609 sec (expires in 2.665 sec)
注意这里命令不一样。
show standby vlan 12

SW3#show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.2.254 - 0000.5e00.0116 ARPA Vlan22
Internet 192.168.1.253 - cc00.0ab0.0000 ARPA Vlan12
Internet 192.168.2.253 - cc00.0ab0.0000 ARPA Vlan22

SW1#show arp
Protocol Address Age (min) Hardware Addr Type Interface
Internet 192.168.2.251 - cc00.0350.0000 ARPA Vlan22
Internet 192.168.1.251 - cc00.0350.0000 ARPA Vlan12
Internet 192.168.1.254 - 0000.0c07.ac0c ARPA Vlan12

show ip route
Gateway of last resort is not set
C 192.168.1.0/24 is directly connected, Vlan12
C 192.168.2.0/24 is directly connected, Vlan22
SW3#
PC1#ping 192.168.2.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 20/48/76 ms
C1#ping 192.168.2.254
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 192.168.2.254, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/41/124 ms

SW1:
inter fa 0/12
no sw
ip addr 14.14.14.1 255.255.255.0
no shut
ip ospf network point-to-point
router ospf 10
network 192.168.1.0 0.0.0.255 ar 0
network 192.168.2.0 0.0.0.255 ar 0 用来做回不的路由备份,即当有数据从SW4到SW2时,而SW3又D掉的情况。
network 14.14.14 .0 0.0.0.255 are 0
passive-interface vlan 12
passive-interface vlan 22
SW3:
inter fa 0/15
no sw
ip addr 34.34.34.3 255.255.255.0
no shut
ip ospf network point-to-point
router ospf 10
network 192.168.1.0 0.0.0.255 ar 0
network 192.168.2.0 0.0.0.255 ar 0
network 14.14.14.0 0.0.0.255 are 0
passive-inter vlan 12
passive-inter vlan 22

SW4:
inter fa 0/12
no sw
no shut
ip addr 14.14.14.4 255.255.255.0
ip ospf network point-to-point
inter fa 0/15
no sw
no shu
ip addr 34.34.34.4 255.255.255.0
ip ospf network point-to-point
int lo 0
ip addr 4.4.4.4 255.255.255.0
ip ospf network point-to-point
router ospf 10
network 4.4.4.0 0.0.0.255 are 0
network 14.14.14.0 0.0.0.255 ar 0
network 34.34.34.0 0.0.0.255 ar 0

Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
C 34.34.34.0 is directly connected, FastEthernet0/15
4.0.0.0/24 is subnetted, 1 subnets
C 4.4.4.0 is directly connected, Loopback0
O 192.168.1.0/24 [110/2] via 34.34.34.3, 00:07:45, FastEthernet0/15
[110/2] via 14.14.14.1, 00:07:45, FastEthernet0/12
O 192.168.2.0/24 [110/2] via 34.34.34.3, 00:07:45, FastEthernet0/15
[110/2] via 14.14.14.1, 00:07:45, FastEthernet0/12
14.0.0.0/24 is subnetted, 1 subnets
C 14.14.14.0 is directly connected, FastEthernet0/12
sw4

-----------
Gateway of last resort is not set
34.0.0.0/24 is subnetted, 1 subnets
O 34.34.34.0 [110/2] via 14.14.14.4, 00:08:26, FastEthernet0/12
4.0.0.0/32 is subnetted, 1 subnets
O 4.4.4.4 [110/2] via 14.14.14.4, 00:08:26, FastEthernet0/12
C 192.168.1.0/24 is directly connected, Vlan12
C 192.168.2.0/24 is directly connected, Vlan22
14.0.0.0/24 is subnetted, 1 subnets
C 14.14.14.0 is directly connected, FastEthernet0/12
SW1#

PC1#trac
PC1#traceroute 4.4.4.4
Type escape sequence to abort.
Tracing the route to 4.4.4.4
1 192.168.1.251 84 msec 108 msec 4 msec
2 14.14.14.4 208 msec * 76 msec
PC1#
SW1(config)#interface fastEthernet 0/12
SW1(config-if)#shu
SW1(config-if)#end
*Mar 1 01:33:50.807: %TRACKING-5-STATE: 1 interface Fa0/12 line-protocol Up->Down
*Mar 1 01:33:50.879: %OSPF-5-ADJCHG: Process 10, Nbr 4.4.4.4 on FastEthernet0/12 from FULL to DOWN, Neighbor Down: Interface down or detached
SW1(config-if)#end
SW1#
*Mar 1 01:33:52.083: %SYS-5-CONFIG_I: Configured from console by console
*Mar 1 01:33:52.787: %LINK-5-CHANGED: Interface FastEthernet0/12, changed state to administratively down
SW1#
*Mar 1 01:33:53.787: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/12, changed state to down
SW1#

SW1#show standby vlan 12
Vlan12 - Group 12
State is Active
2 state changes, last state change 01:06:56
Virtual IP address is 192.168.1.254
Active virtual MAC address is 0000.0c07.ac0c
Local virtual MAC address is 0000.0c07.ac0c (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 1.072 secs
Preemption enabled, delay min 50 secs
Active router is local
Standby router is 192.168.1.253, priority 100 (expires in 7.052 sec)
Priority 90 (configured 150)
Track interface FastEthernet0/12 state Down decrement 60
IP redundancy name is "hsrp-Vl12-12" (default)
SW1#

SW3#show standby
Vlan12 - Group 12
State is Active
2 state changes, last state change 00:00:15
Virtual IP address is 192.168.1.254
Active virtual MAC address is 0000.0c07.ac0c
Local virtual MAC address is 0000.0c07.ac0c (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 2.380 secs
Preemption enabled
Active router is local
Standby router is 192.168.1.251, priority 90 (expires in 7.436 sec)
Priority 100 (default 100)
IP redundancy name is "hsrp-Vl12-12" (default)
SW3#
PC1#traceroute 4.4.4.4
Type escape sequence to abort.
Tracing the route to 4.4.4.4
1 192.168.1.253 64 msec 80 msec 16 msec
2 34.34.34.4 48 msec * 96 msec
PC1#

SW3:
show spanning-tree
Port 13 (FastEthernet0/12) of VLAN1 is blocking
Port path cost 19, Port priority 128, Port Identifier 128.13.
Designated root has priority 32768, address cc00.0350.0000
Designated bridge has priority 32768, address cc00.0a64.0000
Designated port id is 128.13, designated path cost 19
Timers: message age 2, forward delay 0, hold 0
Number of transitions to forwarding state: 1
BPDU: sent 4, received 2328

F0/12 is blocking
PC1----4.4.4.4
pc1--->sw2--->SW1--->SW3--->SW4
当SW1的上联口D掉时,下面的环形接口没有出问题 。
这里有一点,preempt时建议配置延迟,往往一D接口,ACTive就即可发现并抢占而此时协议的邻居关系却往往并没有建立。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  路由 vtp hsrp vrrp 休闲