配置标准命名ACL 问题 使用基本编号的ACL没有实际意义,只有通过阅读具体的条目才能得知该ACL的作用。而且ACL的编号有限制,如传统的标准ACL用199表示,扩展ACL用100199表示。 1)配置标准命名ACL实现拒绝PC2(IP地址为192.168.0.20)对Web Server的访问 方案 命名访问控制列表可以为ACL起一个有意义的名字,通过名称就可以得知该ACL要实现什么功能。同时,因为使用的是名称而不是数字,也就没有了ACL数量上的限制。 网络拓扑如图-7所示: 图-7 步骤 实现此案例需要按照如下步骤进行。 步骤一:将2配置扩展ACL中的扩展访问控制列表移除,其他配置保留 tarena-R1(config)#interface f0/0 tarena-R1(config-if)#no ip access-group 100 in tarena-R1(config-if)#exit tarena-R1(config)#no access-list 100 步骤二:在R2上配置标准的命名访问控制列表 命名访问控制列表的配置总体上和用数字表示的ACL一样,但是更加灵活。 tarena-R2(config)#ip access-list standard denypc2 tarena-R2(config-std-nacl)#deny host 192.168.0.20 tarena-R2(config-std-nacl)#permit any tarena-R2(config-std-nacl)#exit tarena-R2(config)#interface f0/1 tarena-R2(config-if)#ip access-group denypc2 out 步骤三:分别在PC1和PC2上做连通性测试 PC1测试如下所示: PC>ipconfig FastEthernet0 Connection:(default port) Link-local IPv6 Address…: FE80::2E0:F7FF:FED6:54CC IP Address…: 192.168.0.10 Subnet Mask…: 255.255.255.0 Default Gateway…: 192.168.0.1 PC>ping 192.168.2.100 Pinging 192.168.2.100 with 32 bytes of data: Reply from 192.168.2.100: bytes=32 time=0ms TTL=126 Reply from 192.168.2.100: bytes=32 time=0ms TTL=126 Reply from 192.168.2.100: bytes=32 time=0ms TTL=126 Reply from 192.168.2.100: bytes=32 time=0ms TTL=126 Ping statistics for 192.168.2.100: Packets: Sent = 4, Received = 4, Lost = 0 (0% loss), Approximate round trip times in milli-seconds: Minimum = 0ms, Maximum = 0ms, Average = 0ms PC> PC2测试如下所示: PC>ipconfig FastEthernet0 Connection:(default port) Link-local IPv6 Address…: FE80::2D0:BAFF:FE98:9E29 IP Address…: 192.168.0.20 Subnet Mask…: 255.255.255.0 Default Gateway…: 192.168.0.1 PC>ping 192.168.2.100 Pinging 192.168.2.100 with 32 bytes of data: Reply from 192.168.1.2: Destination host unreachable. Reply from 192.168.1.2: Destination host unreachable. Reply from 192.168.1.2: Destination host unreachable. Reply from 192.168.1.2: Destination host unreachable. Ping statistics for 192.168.2.100: Packets: Sent = 4, Received = 0, Lost = 4 (100% loss), PC> 输出结果表明,PC1的访问是正常的,而PC2到Web Server的访问被R2(IP地址为192.168.1.2)拒绝。 步骤四:在R2上查看相关的ACL信息 tarena-R2#show ip access-lists Standard IP access list denypc2 10 deny host 192.168.0.20 (4 match(es)) 20 permit any (4 match(es)) 输出结果也表明,来自于PC2的数据包被拦截。
