思科GNS3配置ACL访问控制列表(标准、拓展、命名控制列表)

实例一:标准访问控制列表的配置

拓扑图如下:

通过配置标准访问列表,禁止PC1主机访问PC3主机。

(1)进行sw的配置如下:

SW#configure terminal    //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
SW(config)#no ip routing    //关闭路由功能
SW(config)#int f1/0   //进入接口模式
SW(config-if)#speed 100   //设置速率为100M
SW(config-if)#duplex full   //设置全双工
SW(config-if)#exit   //退出
SW(config)#
*Mar  1 00:12:46.291: %LINK-3-UPDOWN: Interface FastEthernet1/0, changed state to up
SW(config)#

(2)进行R1的配置如下:

R1#conf t   //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f0/0   //进入接口模式
R1(config-if)#ip add 192.168.10.1 255.255.255.0   //配置IP地址与子网掩码
R1(config-if)#no shut   //开启接口
*Mar  1 00:12:48.579: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:12:49.579: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config-if)#int f0/1   //进入接口模式
R1(config-if)#ip add 192.168.20.1 255.255.255.0   //配置IP地址与子网掩码
R1(config-if)#no shut   //开启接口
R1(config-if)#
*Mar  1 00:13:15.063: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:13:16.063: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#exit    //退出

(3)分别给PC1、PC2、PC3配置IP地址

PC1> 
PC1> ip 192.168.10.2 192.168.10.1   //配置IP和网关
Checking for duplicate address...
PC1 : 192.168.10.2 255.255.255.0 gateway 192.168.10.1PC1> 
PC2> 
PC2> ip 192.168.10.3 192.168.10.1   //配置IP和网关
Checking for duplicate address...
PC1 : 192.168.10.3 255.255.255.0 gateway 192.168.10.1PC2>

PC3> 
PC3> ip 192.168.20.2 192.168.20.1   //配置IP和网关
Checking for duplicate address...
PC1 : 192.168.20.2 255.255.255.0 gateway 192.168.20.1PC3> 

(4)分别用PC1、PC2去pingPC3,都能互通。

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=12.961 ms
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=17.258 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=12.084 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=18.257 msPC1> 
PC2> ping 192.168.20.2
84 bytes from 192.168.20.2 icmp_seq=1 ttl=63 time=19.947 ms
84 bytes from 192.168.20.2 icmp_seq=2 ttl=63 time=11.270 ms
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=14.618 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=20.939 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=12.970 msPC2> 

(5)在R1上配置标准访问控制列表,拒绝PC1访问PC3

R1(config)#access-list 1 deny host 192.168.10.2   //配置标准访问控制列表拒绝PC1的IP地址
R1(config)#access-list 1 permit any   //允许所有IP访问
R1(config)#do show access-list   //查看访问控制列表信息
Standard IP access list 110 deny   192.168.10.220 permit any
R1(config)#int f0/0   //进入接口模式
R1(config-if)#ip access-group 1 in   //将ACL应用到接口(入口)
R1(config-if)#exit   //退出
R1(config)#

(6)再次分别用PC1、PC2去pingPC3,由于设置了访问控制列表,PC1已经不能与PC3互通。

PC1> ping 192.168.20.2
*192.168.10.1 icmp_seq=1 ttl=255 time=9.120 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=2 ttl=255 time=5.016 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=3 ttl=255 time=11.325 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=4 ttl=255 time=2.000 ms (ICMP type:3, code:13, Communication administratively prohibited)
*192.168.10.1 icmp_seq=5 ttl=255 time=5.111 ms (ICMP type:3, code:13, Communication administratively prohibited)PC1> 
PC2> ping 192.168.20.2           
192.168.20.2 icmp_seq=1 timeout
192.168.20.2 icmp_seq=2 timeout
84 bytes from 192.168.20.2 icmp_seq=3 ttl=63 time=16.961 ms
84 bytes from 192.168.20.2 icmp_seq=4 ttl=63 time=21.994 ms
84 bytes from 192.168.20.2 icmp_seq=5 ttl=63 time=17.097 msPC2> 

实例二:拓展访问控制列表的配置

拓扑图如下:

通过拓展访问控制列表,允许win10-1访问Linux的web服务,禁止win10-1访问Linux的其它服务,允许win10-1访问192.168.2.0/24网段。


本文来自互联网用户投稿,文章观点仅代表作者本人,不代表本站立场,不承担相关法律责任。如若转载,请注明出处。 如若内容造成侵权/违法违规/事实不符,请点击【内容举报】进行投诉反馈!

相关文章

立即
投稿

微信公众账号

微信扫一扫加关注

返回
顶部