在所有ACL應用到到接口上時,在最后都有一條默認的deny all條目,所以,如果需要在沒有匹配的報文都正常轉發的話要在最后添加一條permit any條目。
1
1.1 MAC ACL
在接口ge1上應用mac acl 700,允許通過MAC地址為:0003.6B00.xxxx的報文
1.1.1 配置
1)配置一條MAC ACL,允許通過MAC地址為:0003.6B00.xxxx的報文
xNet#configure terminal
xNet(config)#mac acl 700 permit 0003.6B00.0001 ffff.ffff.0000 any 1
xNet(config)#end
xNet#
2)應用於接口上,MAC ACL只能應用於二層口
xNet#configure terminal
xNet(config)#interface ge1
xNet(config-if)#switchport
xNet(config-if)#mac access-group 700 in
xNet(config-if)#end
xNet#
1.2 IP ACL
在接口ge1上應用acl 1,只通過192.168.3.0/24網段的報文,其它的都drop。
1.2.1 配置
xNet#configure terminal
xNet(config)#access-list 1 permit 192.168.3.0 0.0.0.255
xNet(config)#end
xNet#
xNet#configure terminal
xNet(config)#interface ge1
xNet(config-if)#ip-access-group 1 in
xNet(config-if)#end
xNet#
1.3 Extended IP ACL
在接口ge1上應用擴展acl 100,只通過192.168.3.0/24網段的TCP報文,並使用rate-limit限速256kbps,其它的都drop。
1.3.1 配置
1)添加擴展ACL
xNet#configure terminal
xNet(config)#access-list 100 permit tcp 192.168.3.0/24 any rate-limit 256 4
xNet(config)#end
xNet#
2)應用於接口
xNet#configure terminal
xNet(config)#interface ge1
xNet(config-if)#ip-access-group 100 in
xNet(config-if)#end
xNet#
1.4 Expert ACL
在接口ge1上應用專家級acl 2700,只通過匹配到IP:192.168.3.0/24,MAC:0003.6B00.xxxx的TCP報文,並該ACL策略只有在每天08:00:00—20:00:00起效(time-range)。
1.4.1 配置
1)創建一個time-range規則,命名為xxx
xNet#configure terminal
xNet(config)#time-range xxx
xNet(config-tm-range)#periodic daily 08:00:00 to 20:00:00
xNet(config-tm-range)#exit
2)應用於ACL
xNet(config)#access-list 2700 permit tcp 192.168.3.0/24 0003.6B00.0000 ffff.ffff.0000 any any time-range xxx
xNet(config)#end
xNet#
3)ACL應用於接口
xNet#configure terminal
xNet(config)#interface ge1
xNet(config-if)#expert access-group 2700 in
xNet(config-if)#end
xNet#