目录
实验2:在思科模拟器Cisco Packet Tracer实现自反ACL
一、前言
最近在通过Cisco Packet Tracer模拟器学习ACL时,遇到的一点小问题,ACL分为标准的ACL访问控制列表和扩展的访问控制列表,但是当给某一路由器配置了一条访问控制列表,虽然是实现禁止该条例控制列表,但是无法从对端PING回来。具体现象如下:
二、实验
实验1:使用ACL控制链路连通性
实验拓扑图
![](https://img-blog.csdnimg.cn/4a7f0cba7a3a419180856763f2dff41a.png)
测试连通性
![](https://img-blog.csdnimg.cn/6f9e0bd0383b4a82a906d440d6e26065.png)
配置ACL
给路由器0 2911配置ACL(这里只是简单的使用了标准的ACL)
tsy(config)#access-list 11 deny 192.168.10.0 0.0.0.255 //禁止192.168.10.0网段的路由通过
tsy(config)#access-list 11 permit any //注意:这一行是最重要的,在cisco里面只要是创建了访问控制列表(上一条),其余的网段也默认禁止,只有写入这一行才能接触默认的禁止
tsy(config)#int g0/1
tsy(config-if)#ip access-group 11 out //引用到接口G0/1
tsy(config-if)#exit
tsy(config)#exit
查看访问控制列表
tsy#show ip ac
tsy#show ip access-lists
Standard IP access list 11
10 deny 192.168.10.0 0.0.0.255
20 permit any
tsy#
再次测试连通性
![](https://img-blog.csdnimg.cn/eb62ad7b036040c28da94692682952e3.png)
![](https://img-blog.csdnimg.cn/f44811018ee74a3bb39fd5179e92cc81.png)
为什么PC1去PingPC0不通,不只是限制了PC0去往PC1的路由吗?!!!
因为Ping的执行过程,是两个终端之间相互询问与确认的过程:
![](https://img-blog.csdnimg.cn/e0d03b498cd146d58e4b310b56c7e5b9.png)
实验2:在思科模拟器Cisco Packet Tracer实现自反ACL
那我们该如何实现单向的Ping通,对端无法Ping通自己呢?通过在度娘的知识宝库找了一番,参考了百度经验:https://jingyan.baidu.com/article/948f5924a79294d80ef5f95c.html
步骤一:给路由器2911开启securityk9模式
tsy#conf terminal //进入配置模式
tsy(config)#license boot module c2900 technology-package securityk9 //开启securityk9模式
//此处省略
ACCEPT? [yes/no]: Y //确认
tsy#write
Building configuration...
[OK]
tsy#reload //重新启动
//此处省略
tsy>en
tsy#show lic
tsy#show license fe
tsy#show license feature //重启后查看许可文件情况,securityk9已开启
Feature name Enforcement Evaluation Subscription Enabled RightToUse
ipbasek9 no no no yes no
securityk9 yes yes no yes yes
datak9 yes no no no yes
uck9 yes yes no no yes
tsy#conf terminal
Enter configuration commands, one per line. End with CNTL/Z.
tsy(config)#
步骤二:配置ACL
tsy#conf terminal //进入配置模式
tsy(config)#ip access-list extended TSY //添加扩展访问控制列表TSY
tsy(config-ext-nacl)#deny ip any any //禁止所有网段通过
tsy(config-ext-nacl)#exit
tsy(config)#int G0/1 //在接口G0/1中应用
tsy(config-if)#ip access-group TSY in //访问控制列表TSY被应用于接口G0/1的进入通道
tsy(config-if)#exit
tsy(config)#ip inspect name Tong http audit-trail on //这一句我理解的是允许http往返报文的执行,标志为Tong的
tsy(config)#ip inspect name Tong icmp audit-trail on //允许icmp往返报文的执行,标志为Tong的
tsy(config)#int G0/1 //在接口G0/1中应用
tsy(config-if)#ip inspect Tong out //访问控制列表TONG被应用于接口G0/1的输出通道
tsy(config-if)#exit
tsy(config)#exit
这里不知道理解的对不对,望大佬指正!
查看访问控制列表
tsy#show ip access-lists
Extended IP access list TSY
10 deny ip any any (4 match(es))
步骤三:验证连通性
![](https://img-blog.csdnimg.cn/267688612dd246c3973000e73f306ba1.png)
![](https://img-blog.csdnimg.cn/dc6898c272344486aaedeccd20cd7f29.png)
三、总结
这里的自反ACL,只是在思科模拟器中的是这么使用的,但是正确的自反ACL并不是这样的!!!