本文主要是介绍标准ACL的基本用法,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
实例一:标准ACL的基本用法
1.限制PC1访问服务器
2.访问控制列表应用在R2的S0/2/0的in方向
代码如下:
R1配置
en
conf t
hostname R1int f0/0
ip address 192.168.1.254 255.255.255.0
no shutdown
exit
int f0/1
ip address 192.168.2.254 255.255.255.0
no shutdown
exit
int s0/2/0
ip address 192.168.3.254 255.255.255.0
no shutdown
clock rate 64000
exitrouter rip
version 2
network 192.168.1.0
network 192.168.2.0
network 192.168.3.0
exitend
R2配置
en
conf t
hostname R2int s0/2/0
ip address 192.168.3.253 255.255.255.0
ip access-group 101 in
no shutdown
exitint f0/0
ip address 192.168.4.254 255.255.255.0
no shutdown
exitaccess-list 1 deny 192.168.1.0 0.0.0.255
access-list 1 permit anyrouter rip
version 2
network 192.168.3.0
network 192.168.4.0
exitend
测试结果:PC1中ping不通
PC>ping 192.168.4.253
Pinging 192.168.4.253 with 32 bytes of data:
Reply from 192.168.3.253: Destination hostunreachable.
Reply from 192.168.3.253: Destination hostunreachable.
Reply from 192.168.3.253: Destination hostunreachable.
Reply from 192.168.3.253: Destination hostunreachable.
Ping statistics for 192.168.4.253:
Packets:Sent = 4, Received = 0, Lost = 4 (100% loss),
测试结果:PC2中ping通
PC>ping 192.168.4.253
Pinging 192.168.4.253 with 32 bytes of data:
Request timed out.
Reply from 192.168.4.253: bytes=32 time=3ms TTL=126
Reply from 192.168.4.253: bytes=32 time=1ms TTL=126
Reply from 192.168.4.253: bytes=32 time=2ms TTL=126
Ping statistics for 192.168.4.253:
Packets:Sent = 4, Received = 3, Lost = 1 (25% loss),
Approximate round trip times in milli-seconds:
Minimum =1ms, Maximum = 3ms, Average = 2ms
结果分析:访问列表设置成功,并成功起到过滤作用
这篇关于标准ACL的基本用法的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!