Skip to main content

 路由器设置 > 新闻资讯 >

HSRP与VRRP双主双备,均衡负载

2014-02-23 00:14 浏览:

  HSRP配置命令

  m1(config-if)#standby 1 ip 192.168.10.200 配置虚拟网关

  m1(config-if)#standby 1 priority 120 配置优先级,默认为100

  m1(config-if)#standby 1 preempt 配置抢占权

  m1(config-if)#standby 1 timers 3 10 配置hello时间

  m1(config-if)#standby 1 track fastEthernet 0/1 配置端口跟踪

  m1#show standby 查看HSRP信息

  m1#show standby brief 查看HSRP摘要信息

  VRRP配置命令

  m1(config-if)#vrrp 1 ip 192.168.10.200 配置虚拟网关

  m1(config-if)#vrrp 1 priority 120 配置优先级,默认为100

  m1(config-if)#vrrp 1 preempt 配置抢占权

  m1(config)#track 3 interface fastEthernet 1/0 line-protocol 配置端口跟踪索引

  m1(config-if)#vrrp 1 track 3 配置端口跟踪

  m1#show vrrp 查看vrrp信息

  m1#show vrrp brief 查看vrrp摘要信息

  例:

  HRRP及VRRP综合实验

  实验要求:

  1.c1、c2、c3、c4、分别属于vlan10、vlan20、vlan30、vlan40

  2.vlan10和vlan30流量默认从sw1通过,vlan20和vlan40流量默认从sw2经过,当链路出故障,实现流量倒换

  3.vlan10、valn20、vlan30配置HSRP思科私有协议,vlan40配置VRRP标准协议

  

wKiom1MIg3awsuohAAI7eXTBZ10940.jpg

 

  Sw1配置

  !

  interface FastEthernet1/1

  switchport access vlan 10

  !

  interface FastEthernet1/2

  switchport access vlan 20

  !

  interface FastEthernet1/5

  switchport mode trunk

  !

  interface FastEthernet1/15

  switchport mode trunk

  !

  Sw2配置

  !

  interface FastEthernet1/3

  switchport access vlan 30

  !

  interface FastEthernet1/4

  switchport access vlan 40

  !

  interface FastEthernet1/6

  switchport mode trunk

  !

  interface FastEthernet1/15

  switchport mode trunk

  !

  M1配置

  !

  interface FastEthernet1/0

  no switchport

  ip address 202.106.1.1 255.255.255.252

  !

  interface FastEthernet1/5

  switchport mode trunk

  !

  !

  interface Vlan10

  ip address 192.168.10.1 255.255.255.0

  standby 10 ip 192.168.10.200

  standby 10 priority 120

  standby 10 preempt

  standby 10 track FastEthernet1/0

  standby 10 track FastEthernet1/5

  !

  interface Vlan20

  ip address 192.168.20.100 255.255.255.0

  standby 2 ip 192.168.20.200

  standby 2 priority 115

  standby 2 preempt

  !

  interface Vlan30

  ip address 192.168.30.1 255.255.255.0

  standby 3 ip 192.168.30.200

  standby 3 priority 120

  standby 3 preempt

  standby 3 track FastEthernet1/0

  standby 3 track FastEthernet1/5

  !

  interface Vlan40

  ip address 192.168.4.100 255.255.255.0

  vrrp 4 ip 192.168.40.200

  !

  ip route 0.0.0.0 0.0.0.0 202.106.1.2

  !

  M2配置

  !

  track 3 interface FastEthernet1/0 line-protocol

  !

  track 4 interface FastEthernet1/6 line-protocol

  !

  interface FastEthernet1/0

  no switchport

  ip address 202.106.1.6 255.255.255.0

  !

  interface FastEthernet1/6

  switchport mode trunk

  !

  interface Vlan10

  ip address 192.168.10.100 255.255.255.0

  standby 10 ip 192.168.10.200

  standby 10 priority 115

  standby 10 preempt

  !

  interface Vlan20

  ip address 192.168.20.1 255.255.255.0

  standby 2 ip 192.168.20.200

  standby 2 priority 120

  standby 2 preempt

  standby 2 track FastEthernet1/0

  standby 2 track FastEthernet1/6

  !

  interface Vlan30

  ip address 192.168.30.100 255.255.255.0

  standby 3 ip 192.168.30.200

  standby 3 priority 115

  standby 3 preempt

  !

  interface Vlan40

  ip address 192.168.40.1 255.255.255.0

  vrrp 4 ip 192.168.40.200

  vrrp 4 priority 120

  vrrp 4 track 3

  vrrp 4 track 4

  !

  ip route 0.0.0.0 0.0.0.0 202.106.1.5

  !

  R1配置

  !

  interface Loopback0

  ip address 1.1.1.1 255.255.255.255

  !

  interface FastEthernet0/0

  ip address 202.106.1.2 255.255.255.252

  !

  !

  interface FastEthernet0/1

  ip address 202.106.1.5 255.255.255.252

  !

  ip route 192.168.10.0 255.255.255.0 202.106.1.1

  ip route 192.168.10.0 255.255.255.0 202.106.1.6 2

  ip route 192.168.20.0 255.255.255.0 202.106.1.1

  ip route 192.168.30.0 255.255.255.0 202.106.1.6

  ip route 192.168.40.0 255.255.255.0 202.106.1.6

  !