eNSP 综合拓扑实战:OSPF 骨干、DHCP 中继、AC+FIT‑AP、NAT 上网全套配置

拓扑说明:AR1 出口路由器;SW1/SW2 核心交换机;SW3/SW4/SW5/SW6 接入交换机;AC1 控制器 + AP1/AP2/AP3 FIT AP;PC1‑PC4、手机 Cellphone1、STA1/STA2 无线终端;Server1 业务服务器、Client1 外网测试主机。 设备远程:用户名admin,密码123456;所有设备开启 stelnet;VLAN 规划、OSPF、AC+AP、DHCP 中继全部落地可直接复制命令。

一、地址规划表

表格

设备 接口 VLAN IP 地址 说明
AR1 GE0/0/1 10.255.0.1/24 对接 SW1 核心
AR1 GE0/0/2 10.255.0.2/24 对接 SW2 核心
AR1 GE0/0/0 202.1.1.1/24 外网口,连 Client1
VLAN10 用户业务 10.0.10.0/24 网关:10.0.10.254 有线 PC 终端
VLAN20 无线 SSID‑WIFI‑EMP 10.0.20.0/24 网关:10.0.20.254 无线 STA 终端
VLAN30 服务器区 10.0.30.0/24 网关:10.0.30.254 Server1 服务器
VLAN88 AC 管理 VLAN 10.0.88.0/24 网关:10.0.88.254 AP、AC 管理地址
LoopBack0(AC) 10.255.100.1/32 AC 源接口 AC1
SW1 LoopBack0 10.255.100.2/32 OSPF Router‑ID 核心 1
SW2 LoopBack0 10.255.100.3/32 OSPF Router‑ID 核心 2
OSPF Area 0 10.255.0.0/24 骨干区域

所有交换机之间互联链路配置 Trunk,放行 VLAN10,20,30,88;接入口为 Access 对应 VLAN。


🔐 所有设备公共基础配置(每台设备都执行)

复制代码
sysname XXX          # 修改设备名称,例如sysname AR1
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

1️⃣ AR1 出口路由器完整配置

复制代码
sysname AR1
# 基础远程
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

# 接口IP
interface GigabitEthernet 0/0/1
 ip address 10.255.0.1 255.255.255.0
interface GigabitEthernet 0/0/2
 ip address 10.255.0.2 255.255.255.0
interface GigabitEthernet 0/0/0
 ip address 202.1.1.1 255.255.255.0

# OSPF 宣告内网网段
ospf 1 router-id 10.255.100.4
 area 0
  network 10.255.0.0 0.0.0.255
  network 10.0.0.0 0.0.255.255

# 默认路由指向外网;内网回包OSPF学习
ip route-static 0.0.0.0 0.0.0.0 202.1.1.2
# NAT 内网上网
acl number 3000
 rule permit ip source 10.0.0.0 0.0.255.255
interface GigabitEthernet 0/0/0
 nat outbound 3000

2️⃣ SW1 核心交换机配置

复制代码
sysname SW1
# 远程管理
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

# 创建VLAN
vlan batch 10 20 30 88

# VLANIF三层网关
interface Vlanif 10
 ip address 10.0.10.254 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.255.100.1
interface Vlanif 20
 ip address 10.0.20.254 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.255.100.1
interface Vlanif 30
 ip address 10.0.30.254 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.255.100.1
interface Vlanif 88
 ip address 10.0.88.254 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.255.100.1

# Loopback0
interface LoopBack 0
 ip address 10.255.100.2 255.255.255.255

# 上联AR1
interface GigabitEthernet 0/0/21
 port link-type trunk
 port trunk allow-pass vlan 10 20 30 88

# 互联SW2
interface GigabitEthernet 0/0/19
 port link-type trunk
 port trunk allow-pass vlan 10 20 30 88

# 下联接入SW3 SW4
interface GigabitEthernet 0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20 30 88
interface GigabitEthernet 0/0/4
 port link-type trunk
 port trunk allow-pass vlan 10 20 30 88

# OSPF
ospf 1 router-id 10.255.100.2
 area 0
  network 10.0.0.0 0.0.255.255
  network 10.255.100.2 0.0.0.0

3️⃣ SW2 核心交换机配置

复制代码
sysname SW2
# 远程管理
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

vlan batch 10 20 30 88

# VLANIF网关
interface Vlanif 10
 ip address 10.0.10.254 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.255.100.1
interface Vlanif 20
 ip address 10.0.20.254 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.255.100.1
interface Vlanif 30
 ip address 10.0.30.254 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.255.100.1
interface Vlanif 88
 ip address 10.0.88.254 255.255.255.0
 dhcp select relay
 dhcp relay server-ip 10.255.100.1

interface LoopBack 0
 ip address 10.255.100.3 255.255.255.255

# 上联AR1
interface GigabitEthernet 0/0/19
 port link-type trunk
 port trunk allow-pass vlan 10 20 30 88

# 互联SW1
interface GigabitEthernet 0/0/21
 port link-type trunk
 port trunk allow-pass vlan 10 20 30 88

# 下联SW5 SW6
interface GigabitEthernet 0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20 30 88
interface GigabitEthernet 0/0/3
 port link-type trunk
 port trunk allow-pass vlan 10 20 30 88

# OSPF
ospf 1 router-id 10.255.100.3
 area 0
  network 10.0.0.0 0.0.255.255
  network 10.255.100.3 0.0.0.0

4️⃣ 接入交换机 SW3(下联 PC1、AP1)

复制代码
sysname SW3
#远程
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

vlan batch 10 20 88

# 上联SW1
interface GigabitEthernet 0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20 88

# PC1接入VLAN10
interface GigabitEthernet 0/0/3
 port link-type access
 port default vlan 10

# AP1接入VLAN88管理
interface GigabitEthernet 0/0/4
 port link-type access
 port default vlan 88

5️⃣ 接入交换机 SW4(下联 PC2 Server1)

复制代码
sysname SW4
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

vlan batch 10 30

#上联SW1
interface GigabitEthernet 0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 30

# PC2 VLAN10
interface GigabitEthernet 0/0/3
 port link-type access
 port default vlan 10

# Server1 VLAN30
interface GigabitEthernet 0/0/2
 port link-type access
 port default vlan 30

6️⃣ 接入交换机 SW5(PC3 AP2)

复制代码
sysname SW5
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

vlan batch 10 20 88

#上联SW2
interface GigabitEthernet 0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20 88

# PC3 VLAN10
interface GigabitEthernet 0/0/3
 port link-type access
 port default vlan 10

# AP2 VLAN88
interface GigabitEthernet 0/0/4
 port link-type access
 port default vlan 88

##7️⃣ 接入交换机 SW6(PC4 AP3)

复制代码
sysname SW6
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

vlan batch 10 20 88

#上联SW2
interface GigabitEthernet 0/0/1
 port link-type trunk
 port trunk allow-pass vlan 10 20 88

# PC4 VLAN10
interface GigabitEthernet 0/0/3
 port link-type access
 port default vlan 10

# AP3 VLAN88
interface GigabitEthernet 0/0/2
 port link-type access
 port default vlan 88

8️⃣ AC1 控制器完整配置(FIT AP 上线 + DHCP 服务器)

复制代码
sysname AC1
user-interface vty 0 4
 authentication-mode aaa
aaa
 local-user admin password cipher 123456
 local-user admin service-type ssh telnet
 local-user admin privilege level 15
stelnet server enable
ssh user admin
ssh user admin authentication-type password

vlan batch 10 20 88

# LoopBack0,CAPWAP源地址
interface LoopBack 0
 ip address 10.255.100.1 255.255.255.255

# 上联Trunk对接SW1
interface GigabitEthernet 0/0/23
 port link-type trunk
 port trunk allow-pass vlan 10 20 88
interface GigabitEthernet 0/0/24
 port link-type trunk
 port trunk allow-pass vlan 10 20 88

# DHCP服务器(AC做DHCP Server,核心做DHCP中继)
dhcp enable
ip pool VLAN10
 gateway-list 10.0.10.254
 network 10.0.10.0 mask 255.255.255.0
 dns-list 223.5.5.5
 lease day 1
ip pool VLAN20
 gateway-list 10.0.20.254
 network 10.0.20.0 mask 255.255.255.0
 dns-list 223.5.5.5
 lease day 1
ip pool VLAN88
 gateway-list 10.0.88.254
 network 10.0.88.0 mask 255.255.255.0
 dns-list 223.5.5.5
 lease day 0 hour 2

# AC+AP业务
capwap source interface LoopBack 0

wlan
 security-profile name EMP‑WIFI
  security wpa2 psk pass-phrase Admin@123 aes
 ssid-profile name EMP‑SSID
  ssid WIFI‑EMP
 vap-profile name EMP‑VAP
  security-profile EMP‑WIFI
  ssid-profile EMP‑SSID
  service-vlan vlan-id 20

# AP组,AP1 AP2 AP3自动上线
ap-group name EMP‑GROUP
  vap-profile EMP‑VAP wlan 0
ap auth-mode mac-auth
# eNSP中AP设备MAC,根据实际设备替换
ap-id 0 ap-mac 00e0-fc11‑1111 ap-name AP1
ap-id 1 ap-mac 00e0-fc22‑2222 ap-name AP2
ap-id 2 ap-mac 00e0-fc33‑3333 ap-name AP3
ap-id 0 ap-group EMP‑GROUP
ap-id 1 ap-group EMP‑GROUP
ap-id 2 ap-group EMP‑GROUP

# OSPF 宣告
ospf 1 router-id 10.255.100.1
 area 0
  network 10.255.100.1 0.0.0.0
  network 10.0.0.0 0.0.255.255

📌 终端配置

  1. Client1:202.1.1.2/24,网关指向202.1.1.1
  2. Server1:静态 IP 10.0.30.10/24,网关10.0.30.254
  3. PC1‑PC4:DHCP 自动获取地址
  4. 无线终端 Cellphone1、STA1、STA2:连接WIFI‑EMP密码Admin@123,获取 VLAN20 网段地址

✅ 验证命令(排障验收)

复制代码
#路由器
display ospf peer brief
display nat session all

#交换机
display port vlan
display dhcp relay information
display ospf peer brief

#AC控制器
display ap all
display capwap ap all
display ip pool

🧪 业务预期结果

  1. 所有 AP 在 AC 上成功注册,状态为nor正常
  2. PC 有线获取 VLAN10 地址;无线终端获取 VLAN20 地址
  3. 全网 OSPF 全互通,PC 可以访问 Server1 服务器
  4. 内网全部终端可以访问外网 Client1
  5. 所有设备支持ssh admin@设备IP远程登录,密码123456
相关推荐
运维蒙工3 天前
eNSP实战 | 综合企业网|堆叠 + 链路聚合 + VLAN+DHCP + 静态路由
ensp·dhcp·链路聚合·静态路由·堆叠·华为数通
运维蒙工8 天前
eNSP实战 |OSPF多区域拓(Area 0骨干+Area 1非骨干)
ensp·ospf·多区域·动态路由·华为数通·abr
网络设计ensp16 天前
商超网络设计
网络·学习·安全·智能路由器·ensp·华为网络设计
星恒讯工业路由器18 天前
家庭无线组网方式全解析:从单路由到FTTR,哪种适合你?
网络·物联网·智能路由器·路由器·家庭组网·ac+ap·mesh组网
便利店102419 天前
边界与远程:墙、洞与加密通道
运维·服务器·防火墙·acl·nat
吴声子夜歌21 天前
网络安全——网络地址转换及其应用
网络·web安全·nat
月走乂山25 天前
GNS3 实战:从零搭建 VPCS + 交换机 + NAT 上网实验拓扑(附环境排错全记录)
网络工程师·gns3·nat·网络实验·vpcs
代码AC不AC1 个月前
【Linux】NAT与代理
linux·nat·代理
zero_70321 个月前
第二次作业 实验
网络协议·云计算·ensp