组网需求 如图4-5所示,组网中有两台业务服务器,其中Server1通过TCP 8888端口提供服务,Server2通过UDP 6666端口提供服务。需要通过设备DeviceA进行访问控制,8:00~17:00的时间段内禁止IP地址为10.1.1.2、10.2.1.2的两台PC使用这两台服务器提供的服务。其他PC在任何时间都可以访问这两台服务器。 图4-5 配置基于IP地址和端口的安全策略组网图本例中interface1,interface2和interface3分别代表10GE0/0/1,10GE0/0/2和10GE0/0/3。
操作步骤
操作步骤
配置接口IP地址和安全区域,完成网络基本参数配置。
# 配置10GE0/0/1接口IP地址,将接口加入dmz域。
<HUAWEI> system-view
[HUAWEI] sysname DeviceA
[DeviceA] interface 10ge 0/0/1
[DeviceA-10GE0/0/1] undo portswitch
[DeviceA-10GE0/0/1] ip address 10.2.0.1 24
[DeviceA-10GE0/0/1] quit
[DeviceA] firewall zone dmz
[DeviceA-zone-dmz] add interface 10ge 0/0/1
[DeviceA-zone-dmz] quit
# 配置10GE0/0/2接口IP地址,将接口加入trust域。
[DeviceA] interface 10ge 0/0/2
[DeviceA-10GE0/0/2] undo portswitch
[DeviceA-10GE0/0/2] ip address 10.1.1.1 24
[DeviceA-10GE0/0/2] quit
[DeviceA] firewall zone trust
[DeviceA-zone-trust] add interface 10ge 0/0/2
[DeviceA-zone-trust] quit
# 配置10GE0/0/3接口IP地址,将接口加入trust域。
[DeviceA] interface 10ge 0/0/3
[DeviceA-10GE0/0/3] undo portswitch
[DeviceA-10GE0/0/3] ip address 10.2.1.1 24
[DeviceA-10GE0/0/3] quit
[DeviceA] firewall zone trust
[DeviceA-zone-trust] add interface 10ge 0/0/3
[DeviceA-zone-trust] quit
配置名称为server_deny的地址对象,将不允许访问服务器的IP地址加入地址对象。
[DeviceA] ip address-set server_deny type object
[DeviceA-object-address-set-server_deny] address 10.1.1.2 mask 32
[DeviceA-object-address-set-server_deny] address 10.2.1.2 mask 32
[DeviceA-object-address-set-server_deny] quit
配置名称为time_deny的时间段,为特定PC不允许访问服务器的时间。
[DeviceA] time-range time_deny 08:00 to 17:00 daily
配置安全策略规则。
# 配置限制特定PC使用Server1对外提供的服务的安全策略。
[DeviceA] security-policy
[DeviceA-policy-security] rule name policy_sec_deny1
[DeviceA-policy-security-rule-policy_sec_deny1] source-zone trust
[DeviceA-policy-security-rule-policy_sec_deny1] destination-zone dmz
[DeviceA-policy-security-rule-policy_sec_deny1] source-address address-set server_deny
[DeviceA-policy-security-rule-policy_sec_deny1] destination-address 10.2.0.10 32
[DeviceA-policy-security-rule-policy_sec_deny1] service protocol tcp source-port 0 to 65535 destination-port 8888
[DeviceA-policy-security-rule-policy_sec_deny1] time-range time_deny
[DeviceA-policy-security-rule-policy_sec_deny1] action deny
[DeviceA-policy-security-rule-policy_sec_deny1] quit
# 配置限制特定PC使用Server2对外提供的服务的安全策略。
[DeviceA-policy-security] rule name policy_sec_deny2
[DeviceA-policy-security-rule-policy_sec_deny2] source-zone trust
[DeviceA-policy-security-rule-policy_sec_deny2] destination-zone dmz
[DeviceA-policy-security-rule-policy_sec_deny2] source-address address-set server_deny
[DeviceA-policy-security-rule-policy_sec_deny2] destination-address 10.2.0.11 32
[DeviceA-policy-security-rule-policy_sec_deny2] service protocol udp source-port 0 to 65535 destination-port 6666
[DeviceA-policy-security-rule-policy_sec_deny2] time-range time_deny
[DeviceA-policy-security-rule-policy_sec_deny2] action deny
[DeviceA-policy-security-rule-policy_sec_deny2] quit
安全策略是按照配置顺序匹配的,注意先配置细化的后配置宽泛的策略。
检查配置结果
在08:00到17:00时间段内,IP地址为10.1.1.2、10.2.1.2的两台PC无法使用这两台服务器对外提供的服务,在其他时间段可以使用。其他PC在任何时间都可以使用这两台服务器对外提供的服务。
配置脚本
#
sysname DeviceA
#
ip address-set server_deny type object
address 0 10.1.1.2 mask 32
address 1 10.2.1.2 mask 32
#
time-range time_deny 08:00 to 17:00 daily
#
interface 10GE0/0/1
ip address 10.2.0.1 255.255.255.0
#
interface 10GE0/0/2
ip address 10.1.1.1 255.255.255.0
#
interface 10GE0/0/3
ip address 10.2.1.1 255.255.255.0
#
firewall zone trust
set priority 85
add interface 10GE0/0/2
add interface 10GE0/0/3
#
firewall zone dmz
set priority 50
add interface 10GE0/0/1
#
security-policy
rule name policy_sec_deny1
source-zone trust
destination-zone dmz
source-address address-set server_deny
destination-address 10.2.0.10 mask 255.255.255.255
service protocol tcp source-port 0 to 65535 destination-port 8888
time-range time_deny
action deny
rule name policy_sec_deny2
source-zone trust
destination-zone dmz
source-address address-set server_deny
destination-address 10.2.0.11 mask 255.255.255.255
service protocol udp source-port 0 to 65535 destination-port 6666
time-range time_deny
action deny
#
return
|