实验目标:在华为设备上配置vrrp+dhcp,检测vrrp对dhcp是否有影响

目标拓扑:

配置思路:在R1,R2,R3,SW2,SW3上运行ospf路由协议以使全网路由互通,SW2,SW3上配置vrrp+dhcp

;SW4,SW1为普通二层交换机负责接入

配置步骤:1、配置设备接口IP及直连测试

R3:

sys

sysname R3

int lo0

ip addr 3.3.3.3 255.255.255.255

quit

vlan batch 100 200 300

int vlan 100

ip addr 13.1.1.3 255.255.255.0

un sh

int vlan 200

ip addr 23.1.1.3 255.255.255.0

un sh

int vlan 300

ip addr 33.1.1.3 255.255.255.0

un sh

int e0/0/0

port link acc

port de vl 100

int e0/0/2

port lin acc

port de vl 200

int e0/0/1

port link acc

port de vlan 300

quit

dis ip int bri

========================================

R1:

sys

sysname R1

int g0/0/0

ip addr 13.1.1.1 255.255.255.0

int g0/0/2

ip addr 12.1.1.1 255.255.255.0

int g0/0/1

ip addr 10.10.10.1 255.255.255.0

int lo0

ip addr 1.1.1.1 255.255.255.255

quit

dis ip int bri

========================================

R2:

sys

sysname R2

int g0/0/0

ip addr 23.1.1.2 255.255.255.0

int g0/0/2

ip addr 12.1.1.2 255.255.255.0

int g0/0/1

ip addr 20.20.20.2 255.255.255.0

int lo0

ip addr 2.2.2.2 255.255.255.255

quit

dis ip int bri

========================================

SW2:

sys

sysname SW2

vlan batch 10  100 200

int vlan 10

ip addr 10.10.10.2 255.255.255.0

int vlan 100

ip addr 100.1.1.254 255.255.255.0

int vlan 200

ip addr 200.1.1.253 255.255.255.0

int g0/0/1

port link acc

port de vlan 10

int g0/0/2

port link-ty tr

port tr al vl 100 200

int g0/0/4

port link acc

port de vl 200

int lo0

ip addr 11.11.11.11 255.255.255.255

==========================================

SW3:

sys

sysname SW3

vlan batch 20 100 200

int vlan 20

ip addr 20.20.20.3 255.255.255.0

int vlan 100

ip addr 100.1.1.253 255.255.255.0

int vlan 200

ip addr 200.1.1.254 255.255.255.0

int g0/0/1

port lin acc

port de vlan 20

int g0/0/2

port lin tr

port tr al vla 100 200

int lo0

ip addr 22.22.22.22 255.255.255.255

直连测试:各设备之间直连互通

2、配置ospf路由协议并测试

R3:

ospf 110 router-id 3.3.3.3

area 0

net 33.1.1.0 0.0.0.255

net 13.1.1.0 0.0.0.255

net 23.1.1.0 0.0.0.255

net 3.3.3.3 0.0.0.0

R1:

ospf 110 router-id 1.1.1.1

area 0

net 10.10.10.0 0.0.0.255

net 13.1.1.0 0.0.0.255

net 12.1.1.0 0.0.0.255

net 1.1.1.1 0.0.0.0

R2:

ospf 110 router-id 2.2.2.2

area 0

net 23.1.1.0 0.0.0.255

net 12.1.1.0 0.0.0.255

net 20.20.20.0 0.0.0.255

net 2.2.2.2 0.0.0.0

SW2:

ospf 110 router-id 11.11.11.11

area 0

net 10.10.10.0 0.0.0.255

net 11.11.11.11 0.0.0.0

net 100.1.1.0 0.0.0.255

net 200.1.1.0 0.0.0.255

SW3:

ospf 110 router-id 22.22.22.22

area 0

net 20.20.20.0 0.0.0.255

net 22.22.22.22 0.0.0.0

net 100.1.1.0 0.0.0.255

net 200.1.1.0 0.0.0.255

检测:检查以上设备之间邻居是否正常

dis ospf peer bri

检查所有设备到33.1.1.3都能通信

3、在SW2和SW3上配置vrrp+dhcp

SW2:

dhcp enable

ip pool 100

network 100.1.1.0 mask 255.255.255.0

gateway-list 100.1.1.250

excluded-ip-address 100.1.1.253 100.1.1.254

quit

ip pool 200

network 200.1.1.0 mask 255.255.255.0

gateway-list 200.1.1.250

excluded-ip-address 200.1.1.253 200.1.1.254

quit

int vlan 100

dhcp select global

vrrp vrid 1 virtual-ip 100.1.1.250

vrrp vrid 1 priority 120

vrrp vrid 1 track interface g0/0/1 reduced 20

vrrp vrid 1 preempt-mode timer delay 5

int vlan 200

dhcp select global

vrrp vrid 2 virtual-ip 200.1.1.250

vrrp vrid 2 priority 110

vrrp vrid 2 track interface g0/0/1 reduced 20

vrrp vrid 2 preempt-mode disable

=============================================

SW3:

dhcp enable

ip pool 100

network 100.1.1.0 mask 255.255.255.0

gateway-list 100.1.1.250

excluded-ip-address 100.1.1.253 100.1.1.254

quit

ip pool 200

network 200.1.1.0 mask 255.255.255.0

gateway-list 200.1.1.250

excluded-ip-address 200.1.1.253 200.1.1.254

quit

int vlan 100

dhcp select global

vrrp vrid 1 virtual-ip 100.1.1.250

vrrp vrid 1 priority 110

vrrp vrid 1 track interface g0/0/1 reduced 20

vrrp vrid 1 preempt-mode disable

int vlan 200

dhcp select global

vrrp vrid 2 virtual-ip 200.1.1.250

vrrp vrid 2 priority 120

vrrp vrid 2 track interface g0/0/1 reduced 20

vrrp vrid 2 preempt-mode timer delay 5

检查:dis vrrp brief

此时由于并没有配置SW1,所以SW2和SW3之间无法传递广播包,故vrrp报文不能在SW2,SW3之间传递,所以针对于vlan100,vlan200而言,在SW2,SW3上均为主,没有备

配置SW1:

sys

sysname SW1

vlan batch 100 200

int g0/0/1

port link trunk

port tr al vlan 100 200

int g0/0/2

port link trunk

port tr al vlan 100 200

int g0/0/3

port link acc

port de vlan 100

int g0/0/5

port link acc

port de vlan 200

int g0/0/6

port link acc

port de vlan 100

int g0/0/4

port link acc

port de vlan 200

当配置完SW1之后则SW2:

wKioL1VuoIqgOrptAADG-JwygnA238.jpg

SW3:

4、配置客户端测试

CLENET3配置IP为33.1.1.120

CLIENT1,CLIENT5,CLIENT6,CLIENT4均自动获取IP

此时若SW2,SW3下行链路故障则需要丢20个左右的包,而上行链路由于配置了track,当上行链路发生故障时能平滑切换,不会丢包。

5、配置BFD应用于下行链路