建立标准ACL实战

本次实验拓扑图如下:

实验目的:

完成在R1路由上标准ACL的建立,实现实验要求:仅允许PC1访问PC3,禁止PC2对PC3进行访问。

实验步骤:

1、完成三台PC机IP地址的设置

2、对sw二层交换机进行设置

sw#conf t                             //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
sw(config)#no ip routing               //GNS3中原镜像为路由镜像,现改为交换机需关闭路由功能
sw(config)#

3、对R1路由进行设置

R1#conf t                                      //进入全局模式
Enter configuration commands, one per line.  End with CNTL/Z.
R1(config)#int f 0/1                            //进入连接局域网的f0/1接口
R1(config-if)#ip add 192.168.100.1 255.255.255.0        //设置IP作为网关
R1(config-if)#no shut                                   //开启
*Mar  1 00:35:12.835: %LINK-3-UPDOWN: Interface FastEthernet0/1, changed state to up
*Mar  1 00:35:13.835: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
R1(config-if)#int f 0/0                                 //进入连接外网的f0/0
R1(config-if)#ip add 192.168.200.1 255.255.255.0        //设置IP作为网关
R1(config-if)#no shut 
R1(config-if)#ex
*Mar  1 00:35:33.075: %LINK-3-UPDOWN: Interface FastEthernet0/0, changed state to up
*Mar  1 00:35:34.075: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up
R1(config)#
注意:此时,我们并没有在R1路由上设置ACL,PC1与PC2应该均可以与PC3进行互联。为满足实验要求,接下来开始进行标准ACL的设置。

在R1上设置ACL

R1(config)#access-list 1 deny host 192.168.100.30        //拒绝192.168.100.30(PC2)主机通过  
R1(config)#access-list 1 permit any any               //允许所有主机通过(any any代表所有)
R1(config)#int f 0/1                            //进入f0/1接口
R1(config-if)#ip access-group 1 in              //在接口上进行应用
R1(config-if)#do show access-list               //查看ACL
Standard IP access list 1                   
    10 deny   192.168.100.30
    20 permit any
R1(config-if)#

实验结果

以上设置均已完成的情况下,此时三机进行互通,应该为以下情况:

由此可知,实验成功!!!!

未完待续~~~下篇我将为各位带来建立扩展ACL的实战