华为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

相关推荐
爱笑的眼睛1114 小时前
HarmonyOS文件压缩与解压缩API深度解析与实践
华为·harmonyos
xiaocao_102319 小时前
鸿蒙手机上有没有轻便好用的备忘录APP?
华为·智能手机·harmonyos
qq_3168377521 小时前
华为CCE k8s 使用nfs-subdir-external-provisioner 创建pvc时自动创建pv
windows·华为·kubernetes
深盾科技1 天前
鸿蒙应用构建体系深度解析:ABC、HAP、HAR、HSP与APP的技术全貌
华为·harmonyos
一名机电研究生1 天前
华为、阿里巴巴、字节跳动 100+ Linux面试问题总结(一)
linux·华为·面试
q***64971 天前
华为HuaweiCloudStack(一)介绍与架构
服务器·华为·架构
特立独行的猫a2 天前
鸿蒙PC平台三方库移植实战:以libid3tag库为例(附完整移植流程)
华为·harmonyos·移植·鸿蒙pc·libid3tag
爱笑的眼睛112 天前
深入探讨HarmonyOS分布式剪贴板:技术原理与开发实践
华为·harmonyos
特立独行的猫a2 天前
鸿蒙PC平台三方库移植实战:以libogg库移植为例(附完整移植流程与工具链配置)
华为·harmonyos·三方库移植·鸿蒙pc·libogg
爱笑的眼睛112 天前
深入理解HarmonyOS通知渠道与优先级设置:从基础到高级实践
华为·harmonyos