网络构建与访问控制实验

- 添加设备:在 eNSP 中拖入路由器 AR1、交换机 LSW1、LSW2、LSW3 各一台,PC 机 6 台(PC1-PC6)。
- 连接设备:
- AR1 的 GE 0/0/0 接口与 LSW1 的 GE 0/0/4 接口相连。
- LSW1 的 GE 0/0/1 连 PC1,GE 0/0/2 连 PC2,GE 0/0/3 连 LSW2 的 GE 0/0/3。
- LSW2 的 GE 0/0/1 连 PC3,GE 0/0/2 连 PC4,GE 0/0/4 连 LSW3 的 GE 0/0/3。
- LSW3 的 GE 0/0/1 连 PC5,GE 0/0/2 连 PC6。

交换机 LSW1
system-view
sysname LSW1
vlan batch 2 3
interface GigabitEthernet 0/0/1port link-type accessport default vlan 2
interface GigabitEthernet 0/0/2port link-type accessport default vlan 3 // PC2所在VLAN3(因与PC1/3不同网段,需新VLAN)
interface GigabitEthernet 0/0/3port link-type trunkport trunk allow-pass vlan 2 3
interface GigabitEthernet 0/0/4port link-type trunkport trunk allow-pass vlan 2 3
交换机 LSW2
system-view
sysname LSW2
vlan batch 2 3
interface GigabitEthernet 0/0/1port link-type accessport default vlan 2
interface GigabitEthernet 0/0/2port link-type accessport default vlan 3
interface GigabitEthernet 0/0/3port link-type trunkport trunk allow-pass vlan 2 3
interface GigabitEthernet 0/0/4port link-type trunkport trunk allow-pass vlan 3
交换机 LSW3
system-view
sysname LSW3
vlan batch 3 4
interface GigabitEthernet 0/0/1port link-type accessport default vlan 3
interface GigabitEthernet 0/0/2port link-type accessport default vlan 4 // PC6单独VLAN4,用于访问控制
interface GigabitEthernet 0/0/3port link-type trunkport trunk allow-pass vlan 3 4
路由器 AR1 配置(DHCP 与路由)
system-view
sysname AR1
dhcp enable
interface GigabitEthernet 0/0/0ip address 192.168.1.1 255.255.255.0dhcp select interface
interface Vlanif 2ip address 192.168.2.1 255.255.255.0dhcp select interface
interface Vlanif 3ip address 192.168.3.1 255.255.255.0dhcp select interface
interface Vlanif 4ip address 192.168.4.1 255.255.255.0dhcp select interface

访问控制列表(实现 PC4、PC5、PC6 的访问规则)
在 LSW3 上配置 ACL 控制 PC4(VLAN3)与 PC6(VLAN4)、PC5(VLAN3)与 PC6(VLAN4)的访问:
system-view
sysname LSW3
acl 3000rule deny ip source 192.168.3.0 0.0.0.255 destination 192.168.4.0 0.0.0.255
interface GigabitEthernet 0/0/1traffic-filter inbound acl 3000
interface GigabitEthernet 0/0/2traffic-filter inbound acl 3000
PC 配置(DHCP 获取 IP)
将所有 PC 的 IP 获取方式设置为 “DHCP”,即可自动获取对应网段的 IP 地址,实现题目中要求的通信规则。

