标准ACL配置小实验走起
admin
2023-03-04 07:02:50
0

实验要求

在R1路由上建立标准ACL,实现仅允许PC1能访问PC3,禁止PC2对PC3进行访问的功能。

标准ACL配置小实验走起

具体配置

1、配置三台pc机地址、网关

PC1> ip 192.168.10.2 192.168.10.1
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1

PC2> ip 192.168.10.3 192.168.10.1 
Checking for duplicate address...
PC1 : 192.168.10.3 255.255.255.0 gateway 192.168.10.1

PC3> 
PC3> ip 192.168.20.2 192.168.20.1
Checking for duplicate address...
PC1 : 192.168.20.2 255.255.255.0 gateway 192.168.20.1

2、配置交换机sw

sw#conf t 
sw(config)#no ip routing

3、配置路由两端地址、子掩

R1#conf t
R1(config)#int f0/0
R1(config-if)#ip add 192.168.10.1 255.255.255.0
R1(config-if)#no shut
R1(config-if)#int f0/1
R1(config-if)#ip add 192.168.20.1 255.255.255.0
R1(config-if)#no shut

4、测试三台pc连通性,可以互联互通

PC1> ping 192.168.20.2           
192.168.20.2 icmp_seq=1 timeout
84 bytes from 192.168.20.2 icmp_seq=2 ttl=63 time=15.676 ms
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=17.680 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=21.956 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=12.700 ms

PC1> ping 192.168.10.3
192.168.20.2 icmp_seq=1 timeout
192.168.20.2 icmp_seq=2 timeout
84 bytes from 192.168.10.3 icmp_seq=3 ttl=63 time=17.735 ms
84 bytes from 192.168.10.3 icmp_seq=4 ttl=63 time=14.069 ms
84 bytes from 192.168.10.3 icmp_seq=5 ttl=63 time=14.960 ms

5、在路由上定义ACL语句

R1(config-if)#access-list 1 deny host 192.168.10.2    #禁止pc2主机地址
R1(config)#do show access-list
R1(config)#access-list 1 permit any     #不写则默认拒绝所有
R1(config)#int f0/0
R1(config-if)#ip access-group 1 in     #ACL应用在接口f0/0,定义为入口

6、此时用pc1访问pc3

PC1> ping 192.168.20.2
*192.168.10.1 icmp_seq=1 ttl=255 time=20.233 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=2 ttl=255 time=4.913 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=3 ttl=255 time=12.927 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=4 ttl=255 time=12.965 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=5 ttl=255 time=13.958 ms (ICMP type:3, code:13, Communication administratively prohibited)

7、PC1可以ping通PC2

PC1>ping 192.168.10.3
84 bytes from 192.168.10.3 icmp_seq=1 ttl=64 time=0.000 ms
84 bytes from 192.168.10.3 icmp_seq=2 ttl=64 time=0.975 ms
84 bytes from 192.168.10.3 icmp_seq=3 ttl=64 time=0.997 ms
84 bytes from 192.168.10.3 icmp_seq=4 ttl=64 time=0.000 ms
84 bytes from 192.168.10.3 icmp_seq=5 ttl=64 time=1.731 ms

小型标准ACL配置实验成功

相关内容

热门资讯

马斯克官宣:解散xAI! 最新官宣。 当地时间5月6日,埃隆・马斯克在社交平台X正式宣布,xAI将解散并停止作为独立公司运营,...
低端PC的革命来了!Windo... 快科技5月8日消息,Windows Latest对Win11正在内部测试的"低延迟配置"(Low L...
原创 新... ## 933图片插入失败: 'NoneType' object has no attribute '...
荣获“国机杯”卓越奖!安世亚太... 2026年4月30日,在第九届数字中国建设峰会期间,“国机杯”首届工业智能体大赛颁奖典礼于福州海峡国...
曝全球科技巨头争相投资SK海力... IT之家 5 月 8 日消息,据路透社今天报道,消息人士透露,全球各大科技公司争相向 SK 海力士抛...
中国人的AI焦虑,又领先了 《极限审判》 一场AI大辩论正在越演越烈,公众讨论AI的时候,显然已经呈现出了多个派别:降临派积极拥...
上海汇正财经服务费能退吗?看懂...   近期出现部分关于“上海汇正财经服务费能退吗”的讨论,一些投资者将关注点放在费用争议上,可能会忽略...
美军,突然“反击” 当地时间5月7日深夜至8日凌晨,霍尔木兹海峡再度成为世界最危险的水道。美军“特拉克斯顿”号、“佩拉尔...
古镇民宿贴出“艳遇秘诀”等标牌... 近日,网友称在云南丽江束河古镇发现一店铺门口挂出多块标语牌子:“艳遇秘诀,把自己灌醉,给别人机会”…...