华为vrrp+mstp+ospf+dhcp+dhcp relay配置案例

1、左边是vlan 10主桥,右边是vlan 20的主桥,并且互为备桥

2、 vlan 10 vrrp网关默认用左边,vlan 20的vrrp 网关默认用右边,对应mstp生成树

3、两边都track检测,不通就把vrrp减掉60,这样就会自动切另一边了

4、两边vlan 10和20 都启用dhcp代理,帮助pc获取路由器上的地址

R1配置

dhcp enable

ip pool vlan10

gateway-list 192.168.10.254

network 192.168.10.0 mask 255.255.255.0

dns-list 8.8.8.8

ip pool vlan20

gateway-list 192.168.20.254

network 192.168.20.0 mask 255.255.255.0

dns-list 8.8.8.8

interface GigabitEthernet0/0/0

ip address 10.0.0.1 255.255.255.0

ospf enable 1 area 0.0.0.0

interface GigabitEthernet0/0/1

ip address 10.0.1.1 255.255.255.0

ospf enable 1 area 0.0.0.0

dhcp select global

interface GigabitEthernet0/0/2

dhcp select global

interface NULL0

interface LoopBack0

ip address 1.1.1.1 255.255.255.255

ospf enable 1 area 0.0.0.0

ospf 1 router-id 1.1.1.1

default-route-advertise always

area 0.0.0.0

sw1

vlan batch 10 20 100

stp instance 1 root primary

stp instance 2 root secondary

dhcp enable

ip relay address cycle //多dhcp服务器时负载

stp region-configuration

region-name a

instance 1 vlan 10

instance 2 vlan 20

active region-configuration

drop-profile default

dhcp server group vlan10

dhcp-server 10.0.0.1 0

dhcp-server 10.0.1.1 1

interface Vlanif10

ip address 192.168.10.1 255.255.255.0

vrrp vrid 10 virtual-ip 192.168.10.254

vrrp vrid 10 priority 105

vrrp vrid 10 track interface GigabitEthernet0/0/1 reduced 60

vrrp vrid 10 track interface GigabitEthernet0/0/2 reduced 60

ospf enable 1 area 0.0.0.0

dhcp select relay

dhcp relay server-select vlan10

interface Vlanif20

ip address 192.168.20.1 255.255.255.0

vrrp vrid 20 virtual-ip 192.168.20.254

ospf enable 1 area 0.0.0.0

dhcp select relay

dhcp relay server-select vlan10

interface Vlanif100

ip address 10.0.0.2 255.255.255.0

ospf enable 1 area 0.0.0.0

interface MEth0/0/1

interface GigabitEthernet0/0/1

port link-type access

port default vlan 100

interface GigabitEthernet0/0/2

port link-type trunk

port trunk allow-pass vlan 10 20

interface GigabitEthernet0/0/3

port link-type trunk

port trunk allow-pass vlan 10 20

ospf 1 router-id 2.2.2.2

area 0.0.0.0

sw2

vlan batch 10 20 200

stp instance 1 root secondary

stp instance 2 root primary

dhcp enable

ip relay address cycle

diffserv domain default

stp region-configuration

region-name a

instance 1 vlan 10

instance 2 vlan 20

active region-configuration

drop-profile default

dhcp server group vlan10

dhcp-server 10.0.0.1 0

dhcp-server 10.0.1.1 1

interface Vlanif10

ip address 192.168.10.2 255.255.255.0

vrrp vrid 10 virtual-ip 192.168.10.254

ospf enable 1 area 0.0.0.0

dhcp select relay

dhcp relay server-select vlan10

interface Vlanif20

ip address 192.168.20.2 255.255.255.0

vrrp vrid 20 virtual-ip 192.168.20.254

vrrp vrid 20 priority 105

vrrp vrid 20 track interface GigabitEthernet0/0/1 reduced 60

vrrp vrid 20 track interface GigabitEthernet0/0/2 reduced 60

ospf enable 1 area 0.0.0.0

dhcp select relay

dhcp relay server-select vlan10

interface Vlanif200

ip address 10.0.1.2 255.255.255.0

ospf enable 1 area 0.0.0.0

interface MEth0/0/1

interface GigabitEthernet0/0/1

port link-type access

port default vlan 200

interface GigabitEthernet0/0/2

port link-type trunk

port trunk allow-pass vlan 10 20

interface GigabitEthernet0/0/3

port link-type trunk

port trunk allow-pass vlan 10 20

ospf 1 router-id 3.3.3.3

area 0.0.0.0

SW3

vlan batch 10 20

stp region-configuration

region-name a

instance 1 vlan 10

instance 2 vlan 20

active region-configuration

interface MEth0/0/1

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

port link-type access

port default vlan 10

stp edged-port enable

interface GigabitEthernet0/0/4

port link-type access

port default vlan 20

stp edged-port enable

相关推荐
盐焗西兰花6 小时前
鸿蒙学习实战之路-Reader Kit修改翻页方式字体大小及行间距最佳实践
学习·华为·harmonyos
lbb 小魔仙10 小时前
【HarmonyOS实战】React Native 表单实战:在 OpenHarmony 上构建高性能表单
react native·华为·harmonyos
听麟15 小时前
HarmonyOS 6.0+ 跨端智慧政务服务平台开发实战:多端协同办理与电子证照管理落地
笔记·华为·wpf·音视频·harmonyos·政务
前端世界16 小时前
从单设备到多设备协同:鸿蒙分布式计算框架原理与实战解析
华为·harmonyos
前端不太难17 小时前
HarmonyOS App 工程深水区:从能跑到可控
华为·状态模式·harmonyos
ujainu18 小时前
《零依赖!用 Flutter + OpenHarmony 构建鸿蒙风格临时记事本(一):内存 CRUD》
flutter·华为·openharmony
听麟18 小时前
HarmonyOS 6.0+ PC端虚拟仿真训练系统开发实战:3D引擎集成与交互联动落地
笔记·深度学习·3d·华为·交互·harmonyos
江湖有缘18 小时前
基于华为openEuler系统部署Gitblit服务器
运维·服务器·华为
前端世界19 小时前
从一个 entry 写到十几个模块:鸿蒙模块化开发的真实落地方案(含可运行 Demo)
华为·harmonyos
听麟19 小时前
HarmonyOS 6.0+ APP AR文旅导览系统开发实战:空间定位与文物交互落地
人工智能·深度学习·华为·ar·wpf·harmonyos