配置扩展命名ACL(案例)

4.配置扩展命名ACL
问题
使用基本编号的ACL没有实际意义,只有通过阅读具体的条目才能得知该ACL的作用。而且ACL的编号有限制,如传统的标准ACL用199表示,扩展ACL用100199表示。
1)配置扩展命名ACL实现拒绝PC2(IP地址为192.168.0.20)访问Web Server Web服务,但可访问其他服务。
方案
命名访问控制列表可以为ACL起一个有意义的名字,通过名称就可以得知该ACL要实现什么功能。同时,因为使用的是名称而不是数字,也就没有了ACL数量上的限制。
网络拓扑如图-8所示:

图-8在这里插入图片描述
步骤
实现此案例需要按照如下步骤进行。
步骤一:将3配置标准命名ACL中的标准命名访问控制列表移除,其他配置保留
tarena-R2(config)#interface f0/1
tarena-R2(config-if)#no ip access-group denypc2 out
tarena-R2(config-if)#exit
tarena-R2(config)# no ip access-list standard denypc2
步骤二:在R2上配置扩展命名访问控制列表
命名访问控制列表的配置总体上和用数字表示的ACL一样,但是更加灵活。
tarena-R2(config)#ip access-list extended denypc2
tarena-R2(config-ext-nacl)#deny tcp host 192.168.0.20 host 192.168.2.100 eq www
tarena-R2(config-ext-nacl)#permit ip any any
tarena-R2(config)#interface fastEthernet 0/1
tarena-R2(config-if)#ip access-group denypc2 out
步骤三:在R2上查看相关的ACL信息
tarena-R2#show access-lists
Extended IP access list denypc2
10 deny tcp host 192.168.0.20 host 192.168.2.100 eq www
20 permit ip any any
步骤四:在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=1ms 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 = 1ms, Average = 0ms
PC>
HTTP协议的验证如图-9所示:

图-9在这里插入图片描述
从输入结果可以验证,PC1到Web Server的访问没有受到任何影响。
步骤五:在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.2.100: bytes=32 time=1ms TTL=126
Reply from 192.168.2.100: bytes=32 time=1ms TTL=126
Reply from 192.168.2.100: bytes=32 time=2ms 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 = 2ms, Average = 1ms
PC>
HTTP协议的验证,如图-10所示:

图-10在这里插入图片描述
因为只限制了到Web Server的HTTP访问,所以WEB服务已经无法访问,但是仍然可以ping通。

猜你喜欢

转载自blog.csdn.net/xiaozhedeitzhilu/article/details/90546762