基于时间的访问控制列表(ACL)配置实验

基于时间的访问控制列表(ACL)配置实验

【实验目的】

  1. 掌握基于时间的ACL配置。
  2. 认识给予时间的ACL的作用。
  3. 验证配置。

【实验拓扑】

实验拓扑如下图所示。

设备参数如下表所示。

设备

接口

IP地址

子网掩码

默认网关

R1

S0/3/0

192.168.1.1

255.255.255.252

N/A

Fa0/0/0

192.168.2.1

255.255.255.0

N/A

R2

S0/3/0

192.168.1.2

255.255.255.252

N/A

Fa0/0

172.16.10.254

255.255.255.0

N/A

PC1

N/A

192.168.2.2

255.255.255.0

192.168.2.1

Server1

N/A

172.16.10.1

255.255.255.0

172.16.10.254

【实验内容】

1.配置路由协议:

  1. 配置R1和R2的基本网络接口参数,包括IP地址和子网掩码。
  2. 配置R1和R2之间的静态路由协议。

2.基于时间的ACL定义时间段:

  1. 在R1上定义一个名为"worktime"的时间段,时间段设置为工作日的9:00到21:00。

3.配置基于时间的扩展ACL禁用Web服务:

  1. 在R1上配置一个扩展ACL,编号为100。
  2. 使用ACL规则禁止在工作时间内(根据之前定义的时间段)从192.168.2.0/24网段访问172.16.10.0/24网段的Web服务(端口号为80)。
  3. 允许其他任何网段的流量通过。

4.配置基于时间的扩展ACL禁用FTP服务:

在R1上配置另一个扩展ACL,编号为101。

  1. 使用ACL规则禁止在工作时间内从192.168.2.0/24网段访问172.16.10.0/24网段的FTP服务(端口号为20和21)。
  2. 允许其他任何网段的流量通过。

5.配置基于时间的扩展ACL禁用DNS服务:

  1. 在R1上配置第三个扩展ACL,编号为102。
  2. 使用ACL规则禁止在工作时间内从192.168.2.0/24网段访问172.16.10.0/24网段的DNS服务(端口号为53)。
  3. 允许其他任何网段的流量通过。
  4. 通过这些配置,基于时间的ACL限制了特定时间段内不同协议的流量访问。这样可以控制网络上的服务访问,在特定时间段内允许或禁止特定的流量流经网络。

【实验步骤】

1.配置路由协议

  1. R1的基本配置

Router>en

Router#conf t

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

Router(config)#hostname R1

R1(config)#interface f0/0

R1(config-if)#ip address 192.168.2.1 255.255.255.0

R1(config-if)#no shutdown

R1(config-if)#

%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

R1(config-if)#interface s0/3/0

R1(config-if)#ip address 192.168.1.1 255.255.255.252

R1(config-if)#no shutdown

%LINK-5-CHANGED: Interface Serial0/3/0, changed state to down

R1(config-if)#exit

R1(config)#

%LINK-5-CHANGED: Interface Serial0/3/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/3/0, changed state to up

R1(config-if)#exit

R1(config)#ip route 172.16.10.0 255.255.255.0 serial 0/3/0

//配置静态路由协议

(2)R2的基本配置

Router>enable

Router#conf t

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

Router(config)#hostname R2

R2(config)#interface f0/0

R2(config-if)#ip address 172.16.10.254 255.255.255.0

R2(config-if)#no shutdown

R2(config-if)#

%LINK-5-CHANGED: Interface GigabitEthernet0/0, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet0/0, changed state to up

R2(config-if)#interface s0/3/0

R2(config-if)#ip address 192.168.1.2 255.255.255.252

R2(config-if)#no shutdown

R2(config-if)#

%LINK-5-CHANGED: Interface Serial0/3/0, changed state to up

R2(config-if)#exit

R2(config)#

%LINEPROTO-5-UPDOWN: Line protocol on Interface Serial0/3/0, changed state to up

R2(config)#ip route 192.16.2.0 255.255.255.0 serial 0/3/0

(3)Server1的基本配置

 

 

2.基于时间的ACL定义时间段

R1(config)#time-range worktime             

//定义时间段,名为worktime

R1(config-time-range)#periodic weekdays 9:00 to 21:00     

//时间段为工作日的9:00到21:00

  1. 配置基于时间的扩展ACL禁用Web服务

R1(config)#ip access-list extended 100

R1(config-ext-nacl)#deny tcp 192.168.2.0 0.0.0.255 172.16.10.0 0.0.0.255 eq www time-range worktime

//禁用192.168.2.0/24访问

R1(config-ext-nacl)#permit ip any any

//允许其他任何网段访问

R1(config-ext-nacl)#exit

R1(config)#interface s0/3/0

R1(config-if)#ip access-group 100 out

//在s0/3/0接口出方向应用ACL

  1. 配置基于时间的扩展ACL禁用FTP服务

R1(config)#ip access-list extended 101

R1(config-ext-nacl)#deny tcp 192.168.2.0 0.0.0.255 172.16.10.0 0.0.0.255 eq 20 time-range worktime

R1(config-ext-nacl)#deny tcp 192.168.2.0 0.0.0.255 172.16.10.0 0.0.0.255 eq 21 time-range worktime

R1(config-ext-nacl)#permit ip any any

  1. 配置基于时间的扩展ACL禁用DNS服务

R1(config)#ip access-list extended 102

R1(config-ext-nacl)#deny tcp 192.168.2.0 0.0.0.255 172.16.10.0 0.0.0.255 eq 53 time-range worktime

R1(config-ext-nacl)#deny udp 192.168.2.0 0.0.0.255 172.16.10.0 0.0.0.255 eq 53 time-range worktime

R1(config-ext-nacl)#permit ip any any

猜你喜欢

转载自blog.csdn.net/m0_63624418/article/details/131045931