VRRP负载均衡-单臂路由网关模式实验

SW1配置:

vlan batch 10 20

#

stp instance 0 root primary

stp instance 1 root primary

stp instance 2 root secondary

#

interface Eth-Trunk1

port link-type trunk

undo port trunk allow-pass vlan 1

port trunk allow-pass vlan 10 20

stp instance 0 cost 10000

mode lacp-static //模式

max active-linknumber 2

#

interface GigabitEthernet0/0/1

port link-type trunk

port trunk allow-pass vlan 10 20

#

interface GigabitEthernet0/0/2

port link-type trunk

port trunk allow-pass vlan 10 20

#

interface GigabitEthernet0/0/3

eth-trunk 1

#

interface GigabitEthernet0/0/4

eth-trunk 1

#

interface GigabitEthernet0/0/5

port link-type trunk

port trunk allow-pass vlan 10 20

SW2配置:

undo info-center enable

#

vlan batch 10 20

#

stp instance 0 root secondary

stp instance 1 root secondary

stp instance 2 root primary

#

interface Eth-Trunk1

port link-type trunk

undo port trunk allow-pass vlan 1

port trunk allow-pass vlan 10 20

stp instance 0 cost 10000

mode lacp-static

#

interface GigabitEthernet0/0/1

port link-type trunk

port trunk allow-pass vlan 10 20

#

interface GigabitEthernet0/0/2

port link-type trunk

port trunk allow-pass vlan 10 20

#

interface GigabitEthernet0/0/3

eth-trunk 1

#

interface GigabitEthernet0/0/4

eth-trunk 1

#

interface GigabitEthernet0/0/5

port link-type trunk

port trunk allow-pass vlan 10 20

重点在R3和R4配置

AR3配置:

#

acl number 2000

rule 5 permit source 192.168.0.0 0.0.255.255

#

interface GigabitEthernet0/0/0

ip address 100.1.1.1 255.255.255.252

nat outbound 2000

#

interface GigabitEthernet0/0/1

#

interface GigabitEthernet0/0/1.11

dot1q termination vid 10

ip address 192.168.11.1 255.255.255.0

vrrp vrid 1 virtual-ip 192.168.11.250

vrrp vrid 1 priority 105

arp broadcast enable

#

interface GigabitEthernet0/0/1.33

dot1q termination vid 20

ip address 192.168.33.1 255.255.255.0

vrrp vrid 2 virtual-ip 192.168.33.250

arp broadcast enable

#

interface GigabitEthernet0/0/2

ip address 10.1.1.1 255.255.255.252

#

ospf 1

default-route-advertise always //OSPF引入缺省路由

area 0.0.0.0

network 10.1.1.0 0.0.0.3

network 192.168.11.0 0.0.0.255

network 192.168.33.0 0.0.0.255

#

ip route-static 0.0.0.0 0.0.0.0 100.1.1.2

AR4配置:

acl number 2000

rule 5 permit source 192.168.0.0 0.0.255.255

interface GigabitEthernet0/0/0

ip address 200.1.1.2 255.255.255.252

nat outbound 2000

#

interface GigabitEthernet0/0/1.11

dot1q termination vid 10

ip address 192.168.11.2 255.255.255.0

vrrp vrid 1 virtual-ip 192.168.11.250

arp broadcast enable

#

interface GigabitEthernet0/0/1.33

dot1q termination vid 20

ip address 192.168.33.2 255.255.255.0

vrrp vrid 2 virtual-ip 192.168.33.250

vrrp vrid 2 priority 105 //VRRP默认优先级是100 (越大越先有)

vrrp vrid 2 preempt-mode timer delay 60

arp broadcast enable //开启ARP广播

#

interface GigabitEthernet0/0/2

ip address 10.1.1.2 255.255.255.252

#

ospf 1

default-route-advertise

area 0.0.0.0

network 10.1.1.0 0.0.0.3

network 192.168.11.0 0.0.0.255

network 192.168.33.0 0.0.0.255

#

ip route-static 0.0.0.0 0.0.0.0 200.1.1.1

关闭STP核心交换机上联接口(对接路由器)

int gi 0/0/X

stp disable(关闭STP计算接口会收敛更快)

OSPF中一定要宣告 route-ID 1.1.1.1 2.2.2.2 3.3.3.3 由这些来触发心跳hello报文

int look 0

ip add 1.1.1.1 24

相关调试测试命令:

VLAN10用户测试结果:

VLAN20用户测试结果: