LS-NET-009-如何配置基于时间段的ACL

LS-NET-009-如何配置基于时间段的ACL

配置基于时间段的ACL需要三个核心步骤:定义时间段、配置ACL规则、应用ACL策略。以下是详细说明及四大厂商配置对比:

一、通用配置步骤

  1. 定义时间段
    创建时间范围(如工作日8:30-17:30),支持绝对时间(某日期范围)和周期时间(每周重复)。

  2. 配置ACL规则
    在ACL中引用时间段,设置允许/拒绝规则。例如:

    # 示例:允许192.168.1.0/24在工作日访问80端口
    rule permit tcp source 192.168.1.0 0.0.0.255 destination-port eq 80 time-range WORKTIME
    
  3. 应用ACL策略
    将ACL绑定到接口或流策略实现流量过滤[5][8]。


二、四大厂商配置对比

功能 思科(Cisco) 华为(Huawei) 华三(H3C) 锐捷(Ruijie)
时间段定义命令 time-range WORKTIME periodic weekly Mon-Fri 8:30 to 17:30 time-range WORKTIME 8:30 to 17:30 working-day time-range WORKTIME 8:30 to 17:30 working-day time-range WORKTIME 8:30 to 17:30 daily
ACL引用时间段格式 access-list 101 permit tcp any any eq 80 time-range WORKTIME rule permit tcp source any destination any destination-port eq 80 time-range WORKTIME rule permit tcp source any destination any destination-port eq 80 time-range WORKTIME rule permit tcp any any eq www time-range WORKTIME
接口应用命令 interface g0/1; ip access-group 101 in interface g0/0/1; traffic-filter inbound acl 3000 interface g1/0/1; packet-filter 3000 inbound interface g0/1; ip access-group 101 in
时间段类型支持 绝对时间+周期时间 绝对时间+周期时间 绝对时间+周期时间 绝对时间+周期时间
时间格式 24小时制(HH:MM) 24小时制(HH:MM) 24小时制(HH:MM) 24小时制(HH:MM)

三、详细配置命令示例

1. 思科(Cisco)
! 定义时间段
time-range WORKTIME
 periodic weekly Mon-Fri 8:30 to 17:30

! 配置ACL
ip access-list extended TIMED-ACL
 permit tcp 192.168.1.0 0.0.0.255 any eq 80 time-range WORKTIME
 deny tcp any any eq 8001 time-range WORKTIME

! 应用ACL到接口
interface GigabitEthernet0/1
 ip access-group TIMED-ACL in
2. 华为(Huawei)
# 定义时间段
time-range WORKTIME 08:30 to 17:30 working-day

# 配置ACL
acl number 3000
 rule 5 permit tcp source 192.168.1.0 0.0.0.255 destination-port eq www time-range WORKTIME
 rule 10 deny tcp destination-port eq 8001 time-range WORKTIME

# 应用ACL到接口
interface GigabitEthernet0/0/1
 traffic-filter inbound acl 3000
3. 华三(H3C)
# 定义时间段
time-range WORKTIME 08:30 to 17:30 working-day

# 配置ACL
acl advanced 3000
 rule 5 permit tcp source 192.168.1.0 0.0.0.255 destination-port eq www time-range WORKTIME
 rule 10 deny tcp destination-port eq 8001 time-range WORKTIME

# 应用ACL到接口
interface GigabitEthernet1/0/1
 packet-filter 3000 inbound
4. 锐捷(Ruijie)
! 定义时间段
time-range WORKTIME daily 8:30 to 17:30

! 配置ACL
ip access-list extended TIMED-ACL
 permit tcp 192.168.1.0 0.0.0.255 any eq 80 time-range WORKTIME
 deny tcp any any eq 8001 time-range WORKTIME

! 应用ACL到接口
interface GigabitEthernet0/1
 ip access-group TIMED-ACL in

四、注意事项

  1. 设备时间同步:使用NTP确保设备时间准确(如ntp server 192.168.1.100​)。

  2. 验证命令

    • 查看时间段状态:display time-range WORKTIME​(华为/华三)或show time-range​(思科/锐捷)。
    • 检查ACL匹配计数:display acl 3000​(华为/华三)或show access-lists​(思科/锐捷)。

五、官方文档参考

  • 华为ACL配置指南:Huawei ACL配置[18]
  • 思科ACL时间范围配置:Cisco Time-Based ACL
  • 华三ACL配置手册:H3C ACL配置
  • 锐捷ACL配置指南:Ruijie ACL配置

你可能感兴趣的:(话梅糖の网工笔记零散知识点,acl,时间段,配置,华为,思科)