在路由器上配置标准ACL | 您所在的位置:网站首页 › 思科标准acl配置命令 › 在路由器上配置标准ACL |
【实验名称】在路由器上配置标准ACL 【实验目的】 掌握路由器上标准ACL的规则及配置。 【实验任务】 实现网段间互访的安全控制。 【实验原理】 (1)标准访问控制列表(ACL) 标准ACL能通过使用IP包中的源IP地址进行简单的源地址过滤。 配置标准ACL需要在全局配置模式下进行,命令格式: router (config) # access-list ACL_number{permit | deny }source_address dcard-mask
参数: l ACL_number:ACL的编号,取值范围为1~99。 l 关键字permit和deny:表示允许或拒绝通过。 l 参数source address:一个网络地址或一个主机地址。 l 参数dcard-mask: 通配符掩码(反掩码),与子网屏蔽码的方式相反。 (2)应用访问控制列表到具体的端口上 访问控制列表配置完成后,要应用到路由器的具体端口上才能起作用。首先要进入要添加启用访问控制列表的端口,然后再执行以下命令: router(config-if)# ip access-group ACL_number{in | out} 参数: ACL_number:需要应用的ACL号 in | out :对路由器而言,数据流的方向。 【实验内容】 【实验拓扑】 实验时,按照拓扑进行网络的连接,注意主机和交换机连接的端口。 我自己在模拟器上画的实验拓扑如下图
【实验步骤】
步骤1. 路由器Route 0上的基本配置: Route(config)#hostname Route0 //路由器命名 Route0 (config)#interface f0/1 Route0(config-if) #no shutdown Route0(config-if)#ip address 192.168.1.1 255.255.255.0 //给接口配置IP地址 Route0(config-if)#int s1/0 Route0 (config-if)#no shutdown Route0(config-if)#clock rate 64000 //配置时钟频率 Route0 (config-if)#ip add 10.1.2.1 255.255.255.0 Route0 (config-if)#exit Route0 (config)#ip route 192.168.2.0 255.255.255.0 s1/0//配置静态路由
步骤2. 路由器Route 1上的基本配置: Route(config)#hostname Route1 Route1(config)#interface f 0/1 Route1(config-if) #no shutdown Route1(config-if)#ip address 192.168.2.1 255.255.255.0 Route1(config)#int s1/0 Route1(config-if)#no shutdown Route1(config-if)#ip address 10.1.2.2 255.255.255.0 Route1(config-if)#exit Route1(config)#ip route 192.168.1.0 255.255.255.0 s1/0 //配置静态路由
步骤3.做好上述配置后,测试PC1和PC2之间的连通性,保证它们之间能够相互访问。 结果截图: PC0 ping PC1成功
PC1 ping PC0成功 步骤4. 在Route 0上配置标准ACL: Route0 (config)#access-list 1 deny 192.168.1.0 0.0.0.255 //配置标准ACL,不允许192.168.1.0这个网段的流量 Route0 (config)# int s1/0 Route0(config-if)#ip access-group 1 out //将ACL应用到接口s1/0出栈方向 Route0 (config-if)#end Route0 #show access-lists 1 //查看访问列表1的详细信息 结果截图:
步骤5. 测试:做好上述配置,再测试PC1与PC2之间的连通性,若不能ping通,实验成功。 结果截图: 步骤6. 把Route0上的s1/0接口下的ACL去掉,再次检测PC1与PC2之间的连通性。 Route0 (config)# int s1/0 Route0(config-if)#no ip access-group 1 out //把接口s1/0上的ACL去掉 |
CopyRight 2018-2019 实验室设备网 版权所有 |