标准ACL的基本用法

狂风中的少年 提交于 2019-12-06 09:13:40

实例一:标准ACL的基本用法

 

1.限制PC1访问服务器

2.访问控制列表应用在R2的S0/2/0的in方向








代码如下:

 

R1配置

en
conf t
hostname R1
 
int 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
exit
 
 
 
router rip
version 2
network 192.168.1.0
network 192.168.2.0
network 192.168.3.0
exit
 
end


R2配置

en
conf t
hostname R2
 
int s0/2/0
ip address 192.168.3.253 255.255.255.0
ip access-group 101 in
no shutdown
exit
 
int f0/0
ip address 192.168.4.254 255.255.255.0
no shutdown
exit
 
 
access-list 1 deny 192.168.1.0 0.0.0.255
access-list 1 permit any
 
 
 
 
 
router rip
version 2
network 192.168.3.0
network 192.168.4.0
exit
 
end


 

 

 

 

 

 

测试结果: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



结果分析:访问列表设置成功,并成功起到过滤作用



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!