拓扑说明: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
📌 终端配置
- Client1:
202.1.1.2/24,网关指向202.1.1.1 - Server1:静态 IP
10.0.30.10/24,网关10.0.30.254 - PC1‑PC4:DHCP 自动获取地址
- 无线终端 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
🧪 业务预期结果
- 所有 AP 在 AC 上成功注册,状态为
nor正常 - PC 有线获取 VLAN10 地址;无线终端获取 VLAN20 地址
- 全网 OSPF 全互通,PC 可以访问 Server1 服务器
- 内网全部终端可以访问外网 Client1
- 所有设备支持
ssh admin@设备IP远程登录,密码123456