当前位置: 首页 > news >正文

基于华为设备的 OSPF+MSTP+DHCP+NAT 综合网络架构实现

具体要求如图:

拓扑包含:

出口路由器:AR1
公网路由器:ISP
核心交换机:LSW1、LSW2
接入交换机:LSW3、LSW4
终端:PC1、PC2、PC3、PC4
需求:

内网 IP:172.16.0.0/16(VLAN2:172.16.2.0/24,VLAN3:172.16.3.0/24);
核心交换机(LSW1/LSW2)互备,通过 Eth-Trunk、VRRP、MSTP 实现高可用;
所有 PC 通过 DHCP 自动获取 IP;
内网可访问 ISP 环回口(1.1.1.1)。
二、设备详细配置
1. 接入交换机 LSW3 配置
sysname LSW3
# VLAN创建与接口绑定
vlan batch 2 3
interface Ethernet0/0/1
 port link-type access
 port default vlan 2
interface Ethernet0/0/2
 port link-type access
 port default vlan 3
# 与核心交换机互联的Trunk链路
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 3

2. 接入交换机 LSW4 配置
sysname LSW4
# VLAN创建与接口绑定
vlan batch 2 3
interface Ethernet0/0/1
 port link-type access
 port default vlan 2
interface Ethernet0/0/2
 port link-type access
 port default vlan 3
# 与核心交换机互联的Trunk链路
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 3

3. 核心交换机 LSW1 配置
sysname LSW1
# VLAN创建
vlan batch 2 3 10 20
# Eth-Trunk冗余链路(与LSW2互联)
interface Eth-Trunk 1
 port link-type trunk
 port trunk allow-pass vlan 2 3 10 20
interface GigabitEthernet0/0/1
 eth-trunk 1
interface GigabitEthernet0/0/2
 eth-trunk 1
# 与AR1互联的VLANIF(IP:172.16.0.1/30)
interface Vlanif 10
 ip address 172.16.0.1 255.255.255.252
 dhcp select relay
 dhcp relay server-ip 172.16.0.2  # AR1的G0/0/5接口IP
# VLAN2的VRRP与DHCP中继(主用)
interface Vlanif 2
 ip address 172.16.2.1 255.255.255.0
 vrrp vrid 2 virtual-ip 172.16.2.254
 vrrp vrid 2 priority 110
 dhcp select relay
 dhcp relay server-ip 172.16.0.2
# VLAN3的VRRP与DHCP中继(备用)
interface Vlanif 3
 ip address 172.16.3.1 255.255.255.0
 vrrp vrid 3 virtual-ip 172.16.3.254
 dhcp select relay
 dhcp relay server-ip 172.16.0.2
# 与接入层互联的Trunk链路
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 3
# MSTP配置(实例1对应VLAN2,实例2对应VLAN3)
stp region-configuration
 region-name Huawei_MSTP
 revision-level 1
 instance 1 vlan 2
 instance 2 vlan 3
 active region-configuration
stp instance 1 root primary
stp instance 2 root secondary

4. 核心交换机 LSW2 配置
sysname LSW2
# VLAN创建
vlan batch 2 3 10 20
# Eth-Trunk冗余链路(与LSW1互联)
interface Eth-Trunk 1
 port link-type trunk
 port trunk allow-pass vlan 2 3 10 20
interface GigabitEthernet0/0/1
 eth-trunk 1
interface GigabitEthernet0/0/2
 eth-trunk 1
# 与AR1互联的VLANIF(IP:172.16.0.5/30)
interface Vlanif 20
 ip address 172.16.0.5 255.255.255.252
 dhcp select relay
 dhcp relay server-ip 172.16.0.6  # AR1的G0/0/2接口IP
# VLAN2的VRRP与DHCP中继(备用)
interface Vlanif 2
 ip address 172.16.2.2 255.255.255.0
 vrrp vrid 2 virtual-ip 172.16.2.254
 dhcp select relay
 dhcp relay server-ip 172.16.0.6
# VLAN3的VRRP与DHCP中继(主用)
interface Vlanif 3
 ip address 172.16.3.2 255.255.255.0
 vrrp vrid 3 virtual-ip 172.16.3.254
 vrrp vrid 3 priority 110
 dhcp select relay
 dhcp relay server-ip 172.16.0.6
# 与接入层互联的Trunk链路
interface GigabitEthernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 3
# MSTP配置(与LSW1完全一致,实例2为主根)
stp region-configuration
 region-name Huawei_MSTP
 revision-level 1
 instance 1 vlan 2
 instance 2 vlan 3
 active region-configuration
stp instance 1 root secondary
stp instance 2 root primary

5. 出口路由器 AR1 配置
sysname AR1
# 接口IP配置
interface GigabitEthernet0/0/0
 ip address 12.0.0.1 255.255.255.0
interface GigabitEthernet0/0/5
 ip address 172.16.0.2 255.255.255.252
interface GigabitEthernet0/0/2
 ip address 172.16.0.6 255.255.255.252
# DHCP地址池配置(VLAN2)
ip pool VLAN2
 gateway-list 172.16.2.254
 network 172.16.2.0 mask 255.255.255.0
# DHCP地址池配置(VLAN3)
ip pool VLAN3
 gateway-list 172.16.3.254
 network 172.16.3.0 mask 255.255.255.0
# OSPF动态路由(宣告所有直连与内网网段)
ospf 1
 area 0
  network 12.0.0.0 0.0.0.255
  network 172.16.0.0 0.0.0.3
  network 172.16.0.4 0.0.0.3
  network 172.16.2.0 0.0.0.255
  network 172.16.3.0 0.0.0.255
# NAT公网转换(ACL匹配内网网段)
acl 2000
 rule permit source 172.16.2.0 0.0.0.255
 rule permit source 172.16.3.0 0.0.0.255
interface GigabitEthernet0/0/0
 nat outbound 2000

6. 公网路由器 ISP 配置
sysname ISP
# 接口与环回口IP配置
interface GigabitEthernet0/0/0
 ip address 12.0.0.2 255.255.255.0
interface LoopBack0
 ip address 1.1.1.1 255.255.255.0
# OSPF宣告公网与环回网段
ospf 1
 area 0
  network 12.0.0.0 0.0.0.255
  network 1.1.1.0 0.0.0.255

三、实验验证步骤
PC IP 获取验证:在 PC1-PC4 上执行ipconfig,应自动获取172.16.2.x或172.16.3.x地址,网关为172.16.2.254或172.16.3.254。

2.公网访问验证:在任意 PC 上执行ping 1.1.1.1,应能正常通信,说明 NAT 与 OSPF 配置生效。

http://www.dtcms.com/a/532138.html

相关文章:

  • 使用uniapp——实现微信小程序的拖拽排序(vue3+ts)
  • 5.23基于 LabVIEW 的科学计算器设计
  • STM32 异常和中断
  • OWL 简介
  • 元器件网站建设案例网站建设专家联系方式
  • GStreamer实现屏幕录制(视频+麦克风音频)并编码成视频文件
  • asp网站开发教程pdf广安市建设局新网站
  • Actix Web 源码级拆解
  • 模拟32位浮点数的定义,加,减,显示。
  • GitHub等平台形成的开源文化正在重塑家庭日
  • leetcode 228. 汇总区间 python
  • C# List集合
  • F280025的时钟设置
  • PBR太“脏”,手绘太“平”?Substance“风格化PBR”工作流才是版本答案
  • 建设部执业资格注册中心网站logo一键生成器免费版原型图
  • tcpdump 常用命令及参数解析
  • 调用 Google Veo 3.1 API 批量制作电商产品 UGC 视频
  • 网站链接怎么做二维码wordpress支持 nginx
  • 首次使用Gitlab创建项目的详细操作流程
  • 音视频格式转换API接口使用指南
  • 怎么用壳域名做网站wordpress添加形式
  • 网站做视频郑州作网站
  • 【机器学习】Scikit-learn 框架基础
  • [人工智能-大模型-85]:大模型应用层 - AI/AR眼镜:华为智能眼镜、苹果智能眼镜、Google Glass智能眼镜的软硬件技术架构
  • Windows下利用boost库与Windows Api 实现共享内存
  • 绵阳网站建设优化如何做网站的书籍
  • RedisFX Maven 使用教程
  • Python + ADB 手机自动化控制教程
  • MATLAB三维电容仿真与分析
  • Hadoop安全模式详解