interface GigabitEthernet0/0/1
port link - type access
port default vlan 10
quit
interface GigabitEthernet0/0/6
port link - type access
port default vlan 20
quit
interface GigabitEthernet0/0/11
port link - type access
port default vlan 30
quit
接口配置 IP 地址作为各 VLAN 的网关
为 VLAN 10 配置网关:
interface Vlanif10
ip address 192.168.10.1 255.255.255.0
quit
为 VLAN 20 配置网关:
interface Vlanif20
ip address 192.168.20.1 255.255.255.0
quit
为 VLAN 30 配置网关:
interface Vlanif30
ip address 192.168.30.1 255.255.255.0
quit
配置访问控制列表(ACL)实现访问控制
创建 ACL 规则允许财务部访问其他部门:
acl number 3000
rule 5 permit ip source 192.168.10.0 0.0.0.255 destination 192.168.20.0 0.0.0.255
rule 10 permit ip source 192.168.10.0 0.0.0.255 destination 192.168.30.0 0.0.0.255
rule 15 permit ip source 192.168.10.0 0.0.0.255 destination any
创建 ACL 规则禁止其他部门访问财务部:
acl number 3001
rule 5 deny ip source 192.168.20.0 0.0.0.255 destination 192.168.10.0 0.0.0.255
rule 10 deny ip source 192.168.30.0 0.0.0.255 destination 192.168.10.0 0.0.0.255
rule 15 permit ip source any destination any
创建 ACL 规则禁止其他部门相互访问:
acl number 3002
rule 5 deny ip source 192.168.20.0 0.0.0.255 destination 192.168.30.0 0.0.0.255
rule 10 deny ip source 192.168.30.0 0.0.0.255 destination 192.168.20.0 0.0.0.255
rule 15 permit ip source any destination any