問題
使用基本編號的ACL沒有實際意義,只有通過閱讀具體的條目才能得知該ACL的作用。而且ACL的編號有限制,如傳統(tǒng)的標(biāo)準(zhǔn)ACL用1~99表示,擴展ACL用100~199表示。
配置標(biāo)準(zhǔn)命名ACL實現(xiàn)192.168.1.0網(wǎng)段拒絕PC1訪問外部網(wǎng)絡(luò),其他主機無限制。
方案
命名訪問控制列表可以為ACL起一個有意義的名字,通過名稱就可以得知該ACL要實現(xiàn)什么功能。同時,因為使用的是名稱而不是數(shù)字,也就沒有了ACL數(shù)量上的限制。

步驟
1.將配置標(biāo)準(zhǔn)ACL中的擴展訪問控制列表移除,其他配置保留
tarena-R1(config)#interface f0/0
tarena-R1(config-if)#no ip access-group 1 in
tarena-R1(config-if)#exit
tarena-R1(config)#no access-list 1
2.在R2上配置標(biāo)準(zhǔn)的命名訪問控制列表
命名訪問控制列表的配置總體上和用數(shù)字表示的ACL一樣,但是更加靈活。
tarena-R2(config)#ipaccess-list standard text
tarena-R2(config-std-nacl)#deny host 192.168.1.1
tarena-R2(config-std-nacl)#permit 192.168.1.0 0.0.0.255
tarena-R2(config-std-nacl)#exit
tarena-R2(config)#interface f0/0
tarena-R2(config-if)#ipaccess-group text in
3.分別在PC1和PC2上做連通性測試
PC2測試如下所示:PC>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::2E0:F7FF:FED6:54CC
IP Address......................: 192.168.1.2
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.0.1
PC>ping 192.168.4.1
Pinging 192.168.4.1 with 32 bytes of data:
Reply from 192.168.4.1: bytes=32 time=0ms TTL=126
Reply from 192.168.4.1: bytes=32 time=0ms TTL=126
Reply from 192.168.4.1: bytes=32 time=0ms TTL=126
Reply from 192.168.4.1: bytes=32 time=0ms TTL=126
Ping statistics for 192.168.4.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
PC1 測試如下所示:PC>ipconfig
FastEthernet0 Connection:(default port)
Link-local IPv6 Address.........: FE80::2D0:BAFF:FE98:9E29
IP Address......................: 192.168.1.1
Subnet Mask.....................: 255.255.255.0
Default Gateway.................: 192.168.1.254
PC>ping 192.168.4.1
Pinging 192.168.4.1 with 32 bytes of data:
Reply from 192.168.1.254: Destination host unreachable.
Reply from 192.168.1.254: Destination host unreachable.
Reply from 192.168.1.254: Destination host unreachable.
Reply from 192.168.1.254: Destination host unreachable.
Ping statistics for 192.168.4.1:
Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),
輸出結(jié)果表明,PC1的訪問是正常的,而PC2到Web Server的訪問被R2(IP地址為192.168.1.2)拒絕。
4.在R1上查看相關(guān)的ACL信息
tarena-R2#show ip access-lists
Standard IP access list tedu
10 deny host 192.168.1.1 (4 match(es))
20 permit 192.168.1.0 0.0.0.255(4 match(es))
輸出結(jié)果也表明,來自于PC1的數(shù)據(jù)包被攔截。