三层交换+单臂路由+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
相关推荐
huainingning7 小时前
RJ SW Console口忘记密码处理方法
linux·运维·服务器
布裘8 小时前
【银河麒麟】桌面系统循环登录,无法进入桌面?
linux·运维·服务器
慧都小项8 小时前
程序到了Linux才出错?用CLion把调试接到目标环境
linux·运维·服务器
汤姆yu9 小时前
Gemini 4 Argon模型综述:技术、能力与实际使用指南
网络·安全·web安全·ai·大模型
Seraphina369 小时前
SQL注入(二)盲注
网络·数据库·经验分享·笔记·sql
Ruiery10 小时前
Linux 6.6内核内存管理深度解析(一):物理内存初始化 — memblock 怎么把内存交给 buddy
linux·运维·服务器
2401_8685347810 小时前
无线网络规划设计
服务器·网络
螺蛳粉 螺蛳粉10 小时前
第二篇:keepalived VRRP 原理篇:协议与 VIP 漂移机制深入解析
网络·智能路由器·负载均衡·keepalived·高可用
库拉镜像AI牛牛10 小时前
短剧内容自动化生产:知漫剧工作室落地教程
大数据·服务器·前端·人工智能·语音识别
Android系统攻城狮10 小时前
Linux Gstreamer深度解析之gst_audio_encoder_get_frame_max调用流程与实战(五十九)
linux·运维·服务器·gstreamer音视频·音视频进阶·gstreamer音视频进阶