路由与交换|实验五:ACL访问控制列表

实验五 访问控制列表

一、实验目的

掌握ACL的配置。

二、实验条件

Cisco2621 Switch、Cisco 2950 交换机、PacketTrace仿真软件、具备Windows操作系统的PC机

三、实验原理及相关知识

ACL基本原理

四、实验步骤

网络拓扑结构及地址分配如下。

路由与交换|实验五:ACL访问控制列表

 

设备R1(接口  IP地址  子网掩码)

Fa0/0 192.168.10.1  255.255.255.0

Fa0/1 192.168.11.1  255.255.255.0

S0/0/0 10.1.1.1  255.255.255.252

设备R2(接口  IP地址  子网掩码)

S0/0/0 10.1.1.2  255.255.255.252

Fa0/0 192.168.20.1  255.255.255.0

S0/1/0 209.165.200.225 255.255.255.224

S0/0/1 10.2.2.1  255.255.255.252

设备R3(接口  IP地址  子网掩码)

S0/0/1 10.2.2.2  255.255.255.252

Fa0/0 192.168.30.1  255.255.255.0

设备ISP(接口  IP地址  子网掩码)

S0/0/1 209.165.200.226  255.255.255.224

Fa0/0 209.165.201.1  255.255.255.224

Fa0/1 209.165.202.129  255.255.255.224

主机网卡(IP地址  子网掩码)

PC1 网卡 192.168.10.10  255.255.255.0

PC2 网卡 192.168.11.10  255.255.255.0

PC3 网卡 192.168.30.10  255.255.255.0

PC4 网卡 192.168.30.128  255.255.255.0

WEB/TFTP Server0 网卡

192.168.20.254  255.255.255.0

WEB Server1 网卡

209.165.201.30  255.255.255.224

Outside Host 网卡

209.165.202.158 255.255.255.224

 

 

 

1.配置网络地址及路由协议,使全网连通。

2.按要求配置标准ACL将 ACL 应用于路由器接口并检验和测试 ACL 实施

  • 允许主机192.168.10.10访问外网,禁止网络192.168.10. 0访问外网;
  • 禁止主机192.168.30.10访问外网,允许网络192.168.30. 0访问外网;
  • 允许其他访问外网。
  • 配置采用数字编号的标准 ACL

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#acc 10 per 192.168.10.10

Router(config)#acc 10 deny 192.168.30.10

Router(config)#acc 10 deny 192.168.10.0 0.0.0.255

Router(config)#acc 10 per any

Router(config)#int s1/0

Router(config-if)#ip acc 10 out

Router(config-if)#exit

⑵配置采用命名方式的标准 ACL

Router(config)#ip acc standard kill

Router(config-std-nacl)#permit 192.168.10.10

Router(config-std-nacl)#deny 192.168.30.10

Router(config-std-nacl)#deny 192.168.10.0 0.0.0.255

Router(config-std-nacl)#per any

Router(config-std-nacl)#in s1/0

Router(config-if)#ip acc kill out

Router(config-if)#exit

3.按要求配置扩展 ACL,将 ACL 应用于路由器接口并检验和测试 ACL 实施。

⑴为 R1 配置采用数字编号的扩展 ACL

  •  对于 192.168.10.0/24 网络,阻止telnet访问所有位置,并且阻止通过TFTP 访问地址为192.168.20.254 的企业Web/TFTP Server。允许所有其它访问。
  •  对于 192.168.11.0/24 网络,允许通过TFTP和 Web 访问地址为 192.168.20.254 的企业Web/TFTP Server。阻止从 192.168.11.0/24 网络发往 192.168.20.0/24 网络的所有其它流量。
  • 允许所有其它访问。

Router#

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no acc 101 

Router(config)#acc 101 deny tcp 192.168.10.0 0.0.0.255 any eq telnet

Router(config)#acc 101 deny udp any host 192.168.20.254 eq tftp

Router(config)#acc 101 per ip any any

Router(config)#int f0/0

Router(config-if)#ip acc 101 in

 

Router#

Router#conf t

Enter configuration commands, one per line.  End with CNTL/Z.

Router(config)#no acc 102 

Router(config)#acc 102 per udp 192.168.11.0 0.0.0.255 host 192.168.20.254 eq tftp

Router(config)#acc 102 per tcp 192.168.11.0 0.0.0.255 host 192.168.20.254 eq www

Router(config)#acc 102 deny ip 192.168.11.0 0.0.0.255 192.168.20.0 0.0.0.255

Router(config)#acc 102 per ip any any

Router(config)#int f0/1

Router(config-if)#ip acc 102 in

为 R3 配置采用命名方式的扩展 ACL

192.168.30.0/24 网络中前一半 IP 地址的访问策略有如下要求:

  •  拒绝其访问 192.168.20.0/24 网络
  •  允许其访问所有其它目的地址

对 192.168.30.0/24 网络中的后一半 IP 地址有如下限制:

  •  拒绝其访问 192.168.20.0/24 网络
  •  允许其访问 192.168.10.0 和 192.168.11.0
  •  允许其对所有其它位置的www访问

Router(config)#ip acc ext ki23

Router(config-ext-nacl)#deny ip 192.168.30.0 0.0.0.127 192.168.20.0 0.0.0.255

Router(config-ext-nacl)#per ip  192.168.30.0 0.0.0.127 any

Router(config-ext-nacl)#deny ip 192.168.30.128 0.0.0.127 192.168.20.0 0.0.0.255

Router(config-ext-nacl)#per ip 192.168.30.128 0.0.0.127 192.168.10.0 0.0.0.255

Router(config-ext-nacl)#per ip 192.168.30.128 0.0.0.127 192.168.11.0 0.0.0.255

Router(config-ext-nacl)#per tcp 192.168.30.128 0.0.0.127 any eq www

Router(config-ext-nacl)#int f0/0

Router(config-if)#ip acc ki23 in

五、思考题及其它

⑴访问控制列表的作用是什么?

    过滤流入或者流出路由器的非法数据包,实现对网络的安全访问。

  • 标准ACL及扩展ACL一般应该放置在网络中什么位置上?

根据功能的不同,一般来说标准ACL应该放在距离网段最远的端口上,而扩展ACL应该距离网段最近的端口上,从而避免流量浪费。