标准ACL的基本用法

实例一:标准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



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



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值