企业交换网络搭建与安全配置(eNSP)
一、实验拓扑概述
1.1 网络拓扑结构
实验拓扑:核心层 + 接入层,VLAN隔离 + 链路聚合
1.2 IP地址规划
| 设备 | IP地址 | 子网掩码 | 网关 | VLAN |
|---|---|---|---|---|
| PC1 | 192.168.10.1 | 255.255.255.0 | 192.168.10.254 | VLAN 10 |
| PC2 | 192.168.20.1 | 255.255.255.0 | 192.168.20.254 | VLAN 20 |
| PC3 | 192.168.10.2 | 255.255.255.0 | 192.168.10.254 | VLAN 10 |
| PC4 | 192.168.20.2 | 255.255.255.0 | 192.168.20.254 | VLAN 20 |
| LSW6 Vlanif10 | 192.168.10.254 | 255.255.255.0 | — | VLAN 10 |
| LSW6 Vlanif20 | 192.168.20.254 | 255.255.255.0 | — | VLAN 20 |
二、配置命令汇总
2.1 LSW6(核心交换机)配置
sysname LSW6
vlan batch 10 20
interface Eth-Trunk 1
description To-LSW4-LSW5
port link-type trunk
port trunk allow-pass vlan 10 20
interface GigabitEthernet 0/0/1
eth-trunk 1
interface GigabitEthernet 0/0/2
eth-trunk 1
interface Vlanif 10
ip address 192.168.10.254 255.255.255.0
interface Vlanif 20
ip address 192.168.20.254 255.255.255.0
2.2 LSW4(接入交换机)配置
sysname LSW4
vlan batch 10 20
interface Ethernet 0/0/1
description To-PC1
port link-type access
port default vlan 10
port-security enable
port-security max-mac-num 1
port-security protect-action restrict
interface Ethernet 0/0/2
description To-PC2
port link-type access
port default vlan 20
port-security enable
port-security max-mac-num 1
port-security protect-action restrict
interface Eth-Trunk 10
description To-LSW5
port link-type trunk
port trunk allow-pass vlan 10 20
interface Ethernet 0/0/21
eth-trunk 10
interface Ethernet 0/0/22
eth-trunk 10
interface Ethernet 0/0/3
description To-LSW6
port link-type trunk
port trunk allow-pass vlan 10 20
2.3 LSW5(接入交换机)配置
sysname LSW5
vlan batch 10 20
interface Ethernet 0/0/1
description To-PC3
port link-type access
port default vlan 10
port-security enable
port-security max-mac-num 1
port-security protect-action restrict
interface Ethernet 0/0/2
description To-PC4
port link-type access
port default vlan 20
port-security enable
port-security max-mac-num 1
port-security protect-action restrict
interface Eth-Trunk 10
description To-LSW4
port link-type trunk
port trunk allow-pass vlan 10 20
interface Ethernet 0/0/21
eth-trunk 10
interface Ethernet 0/0/22
eth-trunk 10
interface Ethernet 0/0/3
description To-LSW6
port link-type trunk
port trunk allow-pass vlan 10 20
三、核心技术点及实现效果
3.1 VLAN与三层交换
- 同一VLAN内设备二层直连通信
- 不同VLAN间设备通过网关三层路由通信
- 广播域有效隔离,提高网络安全性
3.2 端口安全
启用端口安全 port-security enable
限制MAC数量 port-security max-mac-num 1
违规处理 port-security protect-action restrict
✔ 防止非法设备接入 · 每端口限1台设备 · 违规可监控
3.3 链路聚合
- 两条100M链路提供200M逻辑带宽
- 一条故障时,另一条自动接管
- 流量在多条链路上分布
四、数据流向分析
同VLAN通信(二层转发)
路径:PC1(VLAN10) → LSW4(E0/0/1) → LSW4(Eth-Trunk10) → LSW5 → PC3(VLAN10)
不经过网关,直接在接入层交换机间转发
跨VLAN通信(三层路由)
路径:PC1(VLAN10) → LSW4 → LSW6(路由转发) → LSW4 → PC2(VLAN20)
必须经过LSW6三层路由,实现VLAN间通信