三层交换+单臂路由+ACL网络配置

一、拓扑与IP规划

设备 VLAN 网关 IP地址
PC1/PC3 2 192.168.2.254 192.168.2.1/2
PC2 3 192.168.3.254 192.168.3.1
PC4 4 192.168.4.254 192.168.4.1
PC5 5 192.168.5.254 192.168.5.1
PC6 6 192.168.6.254 192.168.6.1

二、交换机配置

LSW1

复制代码
system-view
vlan batch 2 3 4 5 6
interface GigabitEthernet 0/0/1
port link-type access
port default vlan 2
quit
interface GigabitEthernet 0/0/2
port link-type access
port default vlan 3
quit
interface GigabitEthernet 0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 6
quit
interface GigabitEthernet 0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 6
quit
save

LSW2

复制代码
system-view
vlan batch 2 3 4 5 6
interface GigabitEthernet 0/0/1
port link-type access
port default vlan 2
quit
interface GigabitEthernet 0/0/2
port link-type access
port default vlan 4
quit
interface GigabitEthernet 0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 6
quit
interface GigabitEthernet 0/0/4
port link-type trunk
port trunk allow-pass vlan 2 to 6
quit
save

LSW3

复制代码
system-view
vlan batch 2 3 4 5 6
interface GigabitEthernet 0/0/1
port link-type access
port default vlan 5
quit
interface GigabitEthernet 0/0/2
port link-type access
port default vlan 6
quit
interface GigabitEthernet 0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 6
quit
save

三、路由器配置

复制代码
system-view
dhcp enable
interface GigabitEthernet 0/0/0
ip address 192.168.3.254 255.255.255.0
dhcp select interface
quit
interface GigabitEthernet 0/0/0.2
dot1q termination vid 2
ip address 192.168.2.254 255.255.255.0
arp broadcast enable
dhcp select interface
quit
interface GigabitEthernet 0/0/0.4
dot1q termination vid 4
ip address 192.168.4.254 255.255.255.0
arp broadcast enable
dhcp select interface
quit
interface GigabitEthernet 0/0/0.5
dot1q termination vid 5
ip address 192.168.5.254 255.255.255.0
arp broadcast enable
dhcp select interface
quit
interface GigabitEthernet 0/0/0.6
dot1q termination vid 6
ip address 192.168.6.254 255.255.255.0
arp broadcast enable
dhcp select interface
quit

四、ACL配置

复制代码
acl number 3000
rule 5 permit ip source 192.168.2.0 0.0.0.255
rule 10 permit ip source 192.168.3.0 0.0.0.255
rule 20 permit ip source 192.168.4.0 0.0.0.255 destination 192.168.5.0 0.0.0.255
rule 30 deny ip source 192.168.4.0 0.0.0.255 destination 192.168.6.0 0.0.0.255
rule 40 deny ip source 192.168.5.0 0.0.0.255 destination 192.168.6.0 0.0.0.255
rule 100 permit ip
quit
interface GigabitEthernet 0/0/0
traffic-filter inbound acl 3000
quit
save

五、PC配置

  • PC1: 192.168.2.1/24, GW 192.168.2.254

  • PC2: 192.168.3.1/24, GW 192.168.3.254

  • PC3: 192.168.2.2/24, GW 192.168.2.254

  • PC4: 192.168.4.1/24, GW 192.168.4.254

  • PC5: 192.168.5.1/24, GW 192.168.5.254

  • PC6: 192.168.6.1/24, GW 192.168.6.254

六、验证测试

复制代码
# PC4测试PC5
ping 192.168.5.1  # 应该通
# PC4测试PC6
ping 192.168.6.1  # 应该不通
# PC5测试PC6
ping 192.168.6.1  # 应该不通

七、查看命令

复制代码
display vlan
display ip interface brief
display dhcp server ip-in-use
display acl 3000
相关推荐
zzzzzz3103 天前
9K Star 炸裂开源!这个 C 语言写的代码知识图谱,把 Linux 内核索引压缩到了 3 分钟
linux·服务器·sql
大树887 天前
金刚石散热越强,管路越先见顶
大数据·运维·服务器·人工智能·ai
小宇宙Zz7 天前
Maven依赖冲突
java·服务器·maven
网络研究院7 天前
2026年网络安全
网络·安全·法律·法规·趋势·发展
酣大智7 天前
ARP代理--工作原理
运维·网络·arp·arp代理
treesforest7 天前
AI安全系统如何识别异常访问?IP风险识别正在成为关键能力
网络·人工智能·tcp/ip·安全·web安全
shushangyun_7 天前
2026年快消品B2B系统推荐:支持终端门店订货、促销政策自动化的工具?
java·运维·网络·数据库·人工智能·spring·自动化
古城小栈7 天前
Unix 与 Linux 异同小叙
linux·服务器·unix
2601_961845157 天前
粉笔行测题库|系统班|刷题
网络·百度·微信·微信公众平台·facebook·新浪微博
程序猿阿伟7 天前
《Chrome离线扩展安装的底层逻辑与场景落地指南》
服务器·网络·chrome