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

相关推荐
交叉编译之王 hahaha5 小时前
RK3568平台OpenHarmony系统移植可行性评估
华为·harmonyos
qq_386322698 小时前
华为网路设备学习-22(路由器OSPF-LSA及特殊详解)
学习·华为·智能路由器
Jackilina_Stone8 小时前
【网工】华为配置基础篇①
华为
lqj_本人16 小时前
鸿蒙OS&UniApp实现个性化的搜索框与搜索历史记录#三方框架 #Uniapp
华为·uni-app·harmonyos
SuperHeroWu719 小时前
【HarmonyOS 5】鸿蒙mPaaS详解
华为·harmonyos·鸿蒙·mpaas·alipay
Bruce_Liuxiaowei20 小时前
HarmonyOS NEXT~React Native在鸿蒙系统(HarmonyOS)上的适配现状与技术展望
react native·华为·harmonyos
卓应1 天前
2025年5月华为H12-821新增题库带解析
网络·华为·智能路由器
_waylau1 天前
华为2024年报:鸿蒙生态正在取得历史性突破
华为·开源·harmonyos
SuperHeroWu72 天前
【HarmonyOS 5】鸿蒙碰一碰分享功能开发指南
华为·harmonyos·应用·分享·碰一碰
lqj_本人2 天前
鸿蒙OS&UniApp制作一个小巧的图片浏览器#三方框架 #Uniapp
华为·uni-app·harmonyos