ACL Access Control List - named Access Control List (practical operation !!!)

Named Access Control Lists can flexibly adjust the strategy, the premise is the standard access list and extended access lists on the basis of, no + number can be used to delete a policy ACL. You can also use ACL No. + permit + ip additional ACL policy

lab environment

一台二层交换机
一台三层交换机
四台pc机

Experimental demand

允许vlan10中pc2可以访问pc1
拒绝vlan10中其他访问pc1
允许其他网段中的主机访问pc1

Experimental topology

ACL Access Control List - named Access Control List (practical operation !!!)

1, the configuration sw switcher

sw#conf t     ##全局模式
sw(config)#vlan 10,20   ##创建vlan10,20
sw(config-vlan)#ex
sw(config)#do show vlan-sw b  ##查看vlan

sw(config)#int range fa1/1 -2     ##进入接口f1/1和f1/2
sw(config-if-range)#sw mo acc   ##创建接入链路
sw(config-if-range)#sw acc vlan 10  ##将接口放到vlan10中
sw(config-if-range)#ex

sw(config)#int f1/3    ##进入f1/3接口,创建接入链路放到vlan20中
sw(config-if)#sw mo acc
sw(config-if)#sw acc vlan 20

sw(config-if)#int f1/0  ##进入f1/0中创建trunk链路
sw(config-if)#sw mo t
sw(config-if)#sw t encapsulation dot1q
sw(config-if)#ex
sw(config)#no ip routing   ##关闭路由功能

2, arranged three switches sw-3

sw3#conf t       ##进入全局模式
sw3(config)#int f1/1   进入f1/1接口
sw3(config-if)#no switchport   ##关闭二层接口
sw3(config-if)#ip add 192.168.100.1 255.255.255.0   ##配置接口网关地址
sw3(config-if)#no shut   开启
sw3(config-if)#ex

sw3(config)#vlan 10,20  ##创建vlan10,20
sw3(config-vlan)#ex
sw3(config)#int vlan 10    ##进入vlan10配置网关地址
sw3(config-if)#ip add 192.168.10.1 255.255.255.0
sw3(config-if)#no shut
sw3(config-if)#ex
sw3(config)#int vlan 20   ##进入vlan20配置网关地址
sw3(config-if)#ip add 192.168.20.1 255.255.255.0
sw3(config-if)#no shut
sw3(config-if)#ex

sw3(config)#do show ip int b   ##查看接口ip

Vlan10                     192.168.10.1    YES manual up                    down    
Vlan20                     192.168.20.1    YES manual up                    down 

sw3(config)#int f1/0     ##进入f1/0接口创建trunk链路
sw3(config-if)#sw mo t
sw3(config-if)#sw t encapsulation dot1q
sw3(config-if)#ex

sw3(config)#do show ip route   ##查看路由表

C    192.168.10.0/24 is directly connected, Vlan10
C    192.168.20.0/24 is directly connected, Vlan20
C    192.168.100.0/24 is directly connected, FastEthe

3, configuration pc machine ip address, test the whole network interoperability

pc机1:192.168.100.100
pc机2:192.168.10.10
pc机3:192.168.10.20
pc机4:192.168.20.20

ACL Access Control List - named Access Control List (practical operation !!!)
ACL Access Control List - named Access Control List (practical operation !!!)
ACL Access Control List - named Access Control List (practical operation !!!)
ACL Access Control List - named Access Control List (practical operation !!!)

测试是否全网互通

ACL Access Control List - named Access Control List (practical operation !!!)

4, configure access control list named ACL

sw3(config)#ip access-list standard test  
##设定模式及命名名称,standard为标准,extended为扩展
sw3(config-std-nacl)#permit host 192.168.10.10   ##允许访问主机ip
sw3(config-std-nacl)#deny 192.168.10.0 0.0.0.255  ##拒绝其他10段访问
sw3(config-std-nacl)#permit any  ##允许其他所有主机访问
sw3(config-std-nacl)#ex

sw3(config)#do show access-list   ##查看访问控制列表
Standard IP access list test
        10 permit 192.168.10.10
        20 deny   192.168.10.0, wildcard bits 0.0.0.255
        30 permit any

sw3(config)#int f1/1  ##进入f1/1,将ACL应用于接口于出口方向
sw3(config-if)#ip access-group test out

5, test results ACL access control

1,vlan10中的主机2能够与主机1相通

ACL Access Control List - named Access Control List (practical operation !!!)

2,vlan10中的主机3不能与主机3相通

ACL Access Control List - named Access Control List (practical operation !!!)

3,其他网段的主机4可以与主机1相通

ACL Access Control List - named Access Control List (practical operation !!!)

thanks for reading! ! !

Guess you like

Origin blog.51cto.com/14080162/2443216