某公司通过Switch实现各部门之间的互连,公司要求禁止研发部门和市场部门在上班时间(8:00-17:30)访问工资查询服务器(IP地址为10.164.9.9),总裁办公室不受限制,可随时访问。
配置思路:
1、配置时间段、高级ACL和基于ACL的流分类,使设备可基于时间的ACL,对用户访问服务器的报文进行过滤,从而限制不同用户在特定时间访问特定服务器的权限。
2、配置流行为,拒绝匹配上ACL的报文通过
3、配置并应用流策略,使ACL和流行为生效
#配置接口加入VLAN,并配置VLANIF接口的IP地址
system-view
sysname Switch
vlan batch 10 20 30 100
interface gigabitethernet 0/0/1
port link-type trunk
port trunk allow-pass vlan 10
quit
interface gigabitethernet 0/0/2
port lint-type trunk
port trunk allow-pass vlan 20
quit
interface gigabitethernet 0/0/3
port link-type trunk
port trunk allow-pass 30
quit
interface gigabitethernet 0/0/4
port link-type trunk
port trunk allow-pass 100
quit
interface vlan 10
ip address 10.164.1.1 255.255.255.0
quit
interface vlan 20
ip address 10.164.2.1 255.255.255.0
quit
interface vlan 30
ip address 10.164.3.1 255.255.255.0
quit
interface vlan 100
ip address 10.164.4.1 255.255.255.0
quit
#配置时间段
time-range satime 8:00 to 17:30 working-day
#配置市场部门访问规则
acl 3002
rule deny ip source 10.164.2.0 0.0.0.255 destination 10.164.9.9 0.0.0.0 time-range satime
quit
#配置研发部门访问规则
acl 3003
rule deny ip source 10.164.3.0 0.0.0.255 destination 10.164.9.9 0.0.0.0 time-range satime
quit
#配置基于ACL的流分类c_market,c_rd,对匹配3002,3003的报文进行分类
traffic classifier c_market
if-match acl 3002
quit
traffic classifier c_rd
if-match acl 3003
quit
#配置流行为b_market,b_rd,动作为拒绝报文通过
traffic behavior b_market
deny
quit
traffic behavior b_rd
deny
quit
#配置流策略p_market,p_rd,将流分类c_market,c_rd与流行为b_market,b_rd相关联
traffic policy p_market
classifier c_market behavior b_market
quit
traffic policy p_rd
classfier c_rd behavior b_rd
quit
#应用流策略
interface gigabitethernet 0/0/2
traffic-policy p_market inbound
quit
interface gigabitethernet 0/0/3
traffic-policy p_rd inbound
quit