华为防火墙


防火墙默认的管理接口g0/0/0默认的ip地址为192.168.0.1/24默认g0/0/0接口开启了dhcp server,默认用户名为admin,默认密码为Admin@123

一、 配置案例

1.1 拓扑图

wKioL1kQD5uzR7LpAABuMh7DS5Y740.png-wh_50

GE 0/0/1:10.10.10.1/24
GE 0/0/2:220.10.10.16/24
GE 0/0/3:10.10.11.1/24
WWW服务器:10.10.11.2/24(DMZ区域)
FTP服务器:10.10.11.3/24(DMZ区域)

1.2 Telnet配置

配置VTY 的优先级为3基于密码验证。

# 进入系统视图。

<USG5300> system-view

# 进入用户界面视图

[USG5300] user-interface vty 0 4

# 设置用户界面能够访问的命令级别为level 3

[USG5300-ui-vty0-4] user privilege level 3

配置Password验证

# 配置验证方式为Password验证

[USG5300-ui-vty0-4] authentication-mode password

# 配置验证密码为lantian

[USG5300-ui-vty0-4] set authentication password simple lantian  ###最新版本命令是authentication-mode password cipher huawei@123

配置空闲断开连接时间

# 设置超时为30分钟

[USG5300-ui-vty0-4] idle-timeout 30

[USG5300] firewall packet-filter default permit interzone untrust local direction inbound //加这个从公网不能telnet防火墙。

基于用户名和密码验证

user-interface vty 0 4

 authentication-mode aaa

aaa

 local-user admin password cipher ]MQ;4\]B+4Z,YWX*NZ55OA!!

 local-user admin service-type telnet

 local-user admin level 3

firewall packet-filter default permit interzone untrust local direction inbound

如果不开放trust域到local域的缺省包过滤,那么内网也不能telnet的防火墙,但是默认情况下已经开放了trust域到local域的缺省包过滤

 

1.3 地址配置

内网:

进入GigabitEthernet 0/0/1视图

[USG5300] interface GigabitEthernet 0/0/1

配置GigabitEthernet 0/0/1IP地址
[USG5300-GigabitEthernet0/0/1] ip address 10.10.10.1 255.255.255.0

配置GigabitEthernet 0/0/1加入Trust区域

[USG5300] firewall zone trust

[USG5300-zone-untrust] add interface GigabitEthernet 0/0/1

[USG5300-zone-untrust] quit

外网:

进入GigabitEthernet 0/0/2视图

[USG5300] interface GigabitEthernet 0/0/2

配置GigabitEthernet 0/0/2IP地址

[USG5300-GigabitEthernet0/0/2] ip address 220.10.10.16  255.255.255.0

配置GigabitEthernet 0/0/2加入Untrust区域

[USG5300] firewall zone untrust

[USG5300-zone-untrust] add interface GigabitEthernet 0/0/2

[USG5300-zone-untrust] quit

DMZ

进入GigabitEthernet 0/0/3视图

[USG5300] interface GigabitEthernet 0/0/3

配置GigabitEthernet 0/0/3IP地址。

[USG5300-GigabitEthernet0/0/3] ip address 10.10.11.1  255.255.255.0

[USG5300] firewall zone dmz

[USG5300-zone-untrust] add interface GigabitEthernet 0/0/3

[USG5300-zone-untrust] quit

1.4 防火墙策略

本地策略是指与Local安全区域有关的域间安全策略,用于控制外界与设备本身的互访。

间安全策略就是指不的区域之间的安全策略。

域内安全策略就是指同一个安全区域之间的策略,缺省情况下,同一安全区域内的数据流都允许通过,域内安全策略没有InboundOutbound方向的区分。

策略内按照policy的顺序进行匹配,如果policy 0匹配了,就不会检测policy 1,policyID大小没有关系,谁在前就先匹配谁。

缺省情况下开放local域到其他任意安全区域缺省包过滤,方便设备自身的对外访问。其他接口都没有加安全区域,并且其他域的缺省包过滤关闭。要想设备转发流量必须将接口加入安全区域,并配置域间安全策略或开放缺省包过滤。

安全策略的匹配顺序










 

 

wKiom1kQD0eTDCZ8AAFcy5KNOA8285.png-wh_50


每条安全策略中包括匹配条件、控制动作和UTM等高级安全策略。

匹配条件

安全策略可以指定多种匹配条件,报文必须同时满足所有条件才会匹配上策略。

比如如下策略

policy 1

  policy service service-set dns

policy destination 221.2.219.123 0

policy source 192.168.10.1

在这里policy service的端口53就是指的是221.2.219.12353端口,可以说是目的地址的53端口

域间可以应用多条安全策略,按照策略列表的顺序从上到下匹配。只要匹配到一条策略就不再继续匹配剩下的策略。如果安全策略不是以自动排序方式配置的,策略的优先级按照配置顺序进行排列,越先配置的策略,优先级越高,越先匹配报文。但是也可以手工调整策略之间的优先级。缺省情况下,安全策略就不是以自动排序方式如果安全策略是以自动排序方式配置的,策略的优先级按照策略ID的大小进行排列,策略ID越小,优先级越高,越先匹配报文。此时,策略之间的优先级关系不可调整。policy create-mode auto-sort enable命令用来开启安全策略自动排序功能,默认是关闭的。

如果没有匹配到安全策略,将按缺省包过滤的动作进行处理,所以在配置具体安全策略时要注意与缺省包过滤的关系。例如安全策略中只允许某些报文通过但是没有关闭缺省包过滤,将造成那些没有匹配到安全策略的流量也会通过,就失去配置安全策略的意义了。

同样,如果安全策略中只配置了需要拒绝的流量,其他流量都是允许通过的,这时需要开放缺省包过滤才能实现需求,否则会造成所有流量都不能通过。

执行命令display this查看当前已有的安全策略,策略显示的顺序就是策略的匹配顺序,越前边的优先级越高

执行命令policy move policy-id1 { before | after } policy-id2,调整策略优先级。

UTM策略

安全策略中除了基本的包过滤功能,还可以引用IPSAV、应用控制等UTM策略进行进一步的应用层检测。但前提是匹配到控制动作为permit的流量才能进行UTM处理,如果匹配到deny直接丢弃报文。

安全策略的应用方向

域间的InboundOutbound方向上都可以应用安全策略,需要根据会话的方向合理应用。因为USG是基于会话的安全策略,只对同一会话的首包检测,后续包直接按照首包的动作进行处理。所以对同一条会话来说只需要在首包的发起方向上,也就是访问发起的方向上应用安全策略。

wKioL1kQD7TxYWyGAAB4m2AsbXM404.png-wh_50

上图所示,Trust域的PC访问Untrust域的Server,只需要在TrustUntrustOutbound方向上应用安全策略允许PC访问Server即可,对于Server回应PC的应答报文会命中首包建立的会话而允许通过。

1.4.1 Trust和Untrust域间允许内网用户访问公网

策略一般都是优先级高的在前,优先级低的在后。

policy 1:允许源地址为10.10.10.0/24的网段的报文通过

配置TrustUntrust域间出方向的防火墙策略。  //如果不加policy source就是any,如果不加policy destination目的地址就是any

[USG5300] policy interzone trust untrust outbound

[USG5300-policy-interzone-trust-untrust-outbound] policy 1

[USG5300-policy-interzone-trust-untrust-outbound-1] policy source 10.10.10.0 0.0.0.255 

[USG5300-policy-interzone-trust-untrust-outbound-1] action permit

[USG5300-policy-interzone-trust-untrust-outbound-1] quit

如果是允许所有的内网地址上公网可以用以下命令:

[USG2100]firewall packet-filter default permit interzone trust untrust direction outbound  //必须添加这条命令,或者firewall packet-filter default permit all,但是这样不安全。否则内网不能访问公网。

注意:由优先级高访问优先级低的区域用outbound,比如policy interzone trust untrust outbound这时候policy source ip地址,就是指的优先级高的地址,即trust地址,destination地址就是指的untrust地址。只要是outbound,即使配置成policy interzone untrust trust outbound也会变成policy interzone trust untrust outbound

由优先级低的区域访问优先级高的区域用inbound,比如是policy interzone untrust trust inbound,为了保持优先级高的区域在前,优先级低的区域在后,命令会自动变成policy interzone trust untrust inbound这时候policy source ip地址,就是指的优先级低的地址,即untrust地址,destination地址就是指的优先级高的地址,即trust地址。

总结outbount时,source地址为优先级高的地址,destination地址为优先级低的地址。inbount时,source地址为优先级低的地址destination地址为优先级的地址

配置完成后可以使用display policy interzone trust untrust来查看策略。

1.4.2 DMZUntrust域间:从公网访问内部服务器

policy 2:允许目的地址为10.10.11.2,目的端口为21的报文通过

policy 3:允许目的地址为10.10.11.3,目的端口为8080的报文通过

配置UntrustDMZ域间入方向的防火墙策略,公网访问内网服务器

只需要允许访问内网ip地址即可,不需要配置访问公网的ip地址。

注意在域间策略里匹配的顺序和policy的数字没有关系,他是从前往后检查,如果前一个匹配就不检查下一条了,假如先写的policy 3后写的policy 2,那么就先执行policy 3里的语句,如果policy 3里和policy 2里有相同的地址,只要上一个匹配了就不执行下一个一样的地址了。

举例说明:policy 2里允许192.168.0.1通过,policy 3里拒绝192.168.0.1通过,哪个policy先写的就执行哪个。

[USG5300] policy interzone untrust dmz inbound

[USG5300-policy-interzone-dmz-untrust-inbound] policy 2

[USG5300-policy-interzone-dmz-untrust-inbound-2] policy destination 10.10.11.3 0

[USG5300-policy-interzone-dmz-untrust-inbound-2] policy service service-set ftp

[USG5300-policy-interzone-dmz-untrust-inbound-2] action permit

[USG5300-policy-interzone-dmz-untrust-inbound-2] quit

[USG5300-policy-interzone-dmz-untrust-inbound] policy 3

[USG5300-policy-interzone-dmz-untrust-inbound-3] policy destination 10.10.11.2 0

[USG5300-policy-interzone-dmz-untrust-inbound-3] policy service service-set http

[USG5300-policy-interzone-dmz-untrust-inbound-3] action permit

[USG5300-policy-interzone-dmz-untrust-inbound-3] quit

[USG5300-policy-interzone-dmz-untrust-inbound] quit

 

应用FTPNAT ALG功能。

[USG5300] firewall interzone dmz untrust   ###优先级高的区域在前
[USG5300-interzone-dmz-untrust] detect ftp
[USG5300-interzone-dmz-untrust] quit
USG5300支持FTPHTTPH.323HWCCICQMSNPPTPQQRTSPSIPMGCPSQL.NETNETBIOSMMS等协议的会话时,需要在域间启动ALG功能

配置NAT ALG功能与配置应用层包过滤(ASPF)功能使用的是同一条命令。所以如果已经在域间配置过ASPF功能的话,可以不需要再重复配置NAT ALG功能。

两者的区别在于:

ASPF功能的目的是识别多通道协议,并自动为其开放相应的包过滤策略。

NAT ALG功能的目的是识别多通道协议,并自动转换报文载荷中的IP地址和端口信息。

在域间执行detect命令,将同时开启两个功能。

 

配置内部服务器:

<USG5300> system-view

[USG5300] nat server protocol tcp global 220.10.10.16 8080 inside 10.10.11.2 www

[USG5300] nat server protocol tcp global 220.10.10.17 ftp inside 10.10.11.3 ftp

1.4.3 NAT策略

TrustUntrust域间  如果是同一个区域,比如trusttrust就是域内。

基于源IP地址转换方向

Outbound方向:数据包从高安全级别流向低安全级别

Inbound方向:数据包从低安全级别流向高安全级别

高优先级与低优先级是相对的

根据基于源IP地址端口是否转换分为no-pat方式和napt方式

No-PAT方式:用于一对一IP地址转换,不涉及端口转换

NAPT方式:用于多对一或多对多IP地址转换,涉及端口转换

1通过地址池的方式

policy 1:允许网段为10.10.10.0/24的内网用户访问Internet时进行源地址转换,采用公网地址池的形式。

配置地址池

[USG5300]nat address-group 1 220.10.10.16 220.10.10.20

配置TrustUntrust域间出方向的策略

[USG5300] nat-policy interzone trust untrust outbound

[USG5300--policy-interzone-trust-untrust-outbound] policy 1

[USG5300- nat-policy -interzone-trust-untrust-outbound-1] policy source 10.10.10.0 0.0.0.255

[USG5300- nat-policy -interzone-trust-untrust-outbound-1] action source-nat

[USG5300- nat -policy-interzone-trust-untrust-outbound-1] address-group 1 [no pat]

如果是基于外网接口的nat转换可以不用配置地址池,直接在nat-policy interzone trust untrust outbound里配置eary-ip 外网接口

这里的policy source指的是trust地址,nat转换成untrust地址,如果是nat-policy interzone trust untrust inbound,源地址就是指untrust地址,转换成trust地址。

2通过公网接口的方式

创建Trust区域和Untrust区域之间的NAT策略,确定进行NAT转换的源地址范围192.168.1.0/24网段,并且将其与外网接口GigabitEthernet 0/0/4进行绑定。

[USG] nat-policy interzone trust untrust outbound

[USG-nat-policy-interzone-trust-untrust-outbound] policy 0

[USG-nat-policy-interzone-trust-untrust-outbound-0] policy source 192.168.1.0 0.0.0.255

[USG-nat-policy-interzone-trust-untrust-outbound-0] action source-nat

[USG-nat-policy-interzone-trust-untrust-outbound-0] easy-ip GigabitEthernet 0/0/4

[USG-nat-policy-interzone-trust-untrust-outbound-0] quit

3直接在接口启用nat

如果是针对内网用户上公网做nat,需要在内网接口使用

[USG-GigabitEthernet0/0/0]nat enable

、其他常用配置

2.1 查看防火墙的会话的命令

[USG5320]dis firewall session table [source|destination] [inside|global]可以查看这个数据包有没有过来。

display firewall session table verbose source inside 2.2.2.2   //inside可以查看私网ip地址信息,global可以查看公网ip地址信息。

wKiom1kQD-uw9wggAAAi0J1pkhs329.png-wh_50

如上图所示

icmp表示协议的类型

local --> trust 表示这个包是从local区域到trust区域的

192.168.200.5:1 --> 172.16.4.66:2048表示这个包是从192.168.200.5访问172.16.4.66的,如果该会话项有[]就表示做了nat转换,[]地址是转换后的地址。如果该会话项为“+->”表示启用了ASPF;

-->packets:14 bytes:840表示该会话出方向的包数和字节数统计

<--packets:5 bytes:420 表示该会话入方向的包数和字节数统计。

 

wKioL1kQEAfwQeUDAAAkliYPHlg911.png-wh_50

上图所示:“<--packets:0 bytes:0”表示回来的包没有收到。

2.2 查看防火墙序列号

display firewall esn 可以查看防火墙的序列号

wKioL1kQEB7xlZd9AAAMGhsR3kY044.png-wh_50

 

 

2.3 DHCP配置

2.3.1 接口dhcp

用接口的DHCP功能 (在某个VLAN接口下启用DHCP功能,这个VLAN里的所有主机将自动获得IP地址,网段就是接口IP的网段,网关为接口IP

例:

[USG5300] dhcp enable  (启用dhcp服务,缺省情况下启用)
[USG5300] interface Vlan-interface2
[USG5300-Vlanif2] ip address 219.225.149.1 255.255.255.0
[USG5300-Vlanif2] dhcp select interface (启用接口的DHCP功能)
[USG5300-Vlanif2] dhcp server static-bind ip-address 219.225.149.8 mac-address 00e0-4c58-0d26(做IPmac绑定, 对于一些特定的客户端(例如WWW服务器)需要静态分配固定IP地址,此时可以在DHCP服务器侧绑定IP地址和特定客户端MAC地址。
[USG5300-Vlanif2] dhcp server dns-list 219.225.128.6 219.225.159.6(指定DNS地址

[USG5300-Vlanif2] dhcp server ip-range 10.1.1.1 10.1.1.100  (配置接口地址池的IP地址范围, 缺省情况下,接口地址池的地址范围就是接口的IP地址所在的网段)

[USG5300] dhcp server forbidden-ip 10.110.1.1 10.110.1.63 (配置DHCP地址池中不参与自动分配的IP地址)

2.3.2全局DHCP功能

[USG5300] dhcp enable
[USG5300] dhcp server ip-pool 136 (定义一个全局的地址池,名子自己定义)
[USG5300-dhcp-136]network 219.225.136.0 mask 255.255.255.0(这个地址池可供分配的IP段)
[USG5300-dhcp-136]gateway-list 219.225.136.1(必须写网关,否则自动分配的IP地址无网关)
[USG5300-dhcp-136]dns-list 219.225.128.6DNS配置)

[USG5300-dhcp-136] static-bind ip -address 10.1.1.1 mask 255.255.255.0

[USG5300-dhcp-136] static-bind mac-address 0000-e03f-0305
#
[USG5300]dhcp server ip-pool 149(定义一个全局的地址池,名子自己定义)
[USG5300-dhcp-149]network 219.225.149.0 mask 255.255.255.0(这个地址池可供分配的IP段)
[USG5300-dhcp-149]gateway-list 219.225.149.1(自动获取的IP主机获得的网关)
[USG5300-dhcp-149]dns-list 219.225.128.6DNS配置)

[USG5300]interface Vlan-interface2 (定义vlan接口,自由定义)
[USG5300-Vlanif2]dhcp select globle(接口上启用dhcp select globle功能)
[USG5300-Vlanif2]ip address 219.225.136.1 255.255.255.0(vlan接口必须要分一个IP,即与网关相同的IP,系统根据接口IP与掩码确定自动分配哪一个IP-PoolIP

[USG5300] interface Vlan-interface3 (定义vlan接口,自由定义)
[USG5300-Vlanif3]dhcp select globle(接口上启用dhcp select globle功能)
[USG5300-Vlanif3]ip address 219.225.149.1 255.255.255.0(vlan接口必须要分一个IP,即与网关相同的IP,系统根据接口IP与掩码确定自动分配哪一个IP-PoolIP

2.4 配置透明模式

目前华为的防火墙不支持透明模式的命令,只能用Vlan,把端口加入到vlan方式。

[USG5300] vlan 2

[USG5300] int g0/0/0

[USG5300-GigabitEthernet0/0/0] portswitch

[USG5300-GigabitEthernet0/0/0] port link-type access

[USG5300-GigabitEthernet0/0/0] port access vlan 2

[USG5300] int g0/0/1

[USG5300-GigabitEthernet0/0/1]portswitch

[USG5300-GigabitEthernet0/0/1] port link-type access

[USG5300-GigabitEthernet0/0/1] port access vlan 2

然后把相应的端口加入到相应的区域就可以了!一般只需要加物理接口即可。

如果防火墙只是用在服务器和内网之间,一般将连接服务器接口设置为trust,将内网设置为untrust

子接口的配置方法:子接口不能配置portswitch命令,可以子接口划分到某个vlan

[USG5300-GigabitEthernet0/0/3]int g0/0/3.1

[USG5300-GigabitEthernet0/0/3.1]vlan-type dot1q 60

设置GigabitEthernet 0/0/3.1VLAN ID 60相关联,以太网子接口GigabitEthernet 0/0/3.1的封装格式为dot1q

2.5 配置时钟

用户模式下

<USG5300> clock timezone Beijing minus 08:00:00

<USG5300> clock datetime 0:0:0 2012/12/01

display clock可以查看时间

2.6 系统更新

2.6.1 使用命令进行升级

1、 将升级文件上传到防火墙

<USG5300> tftp 192.168.0.100 get su5mpua07v3r1c00spc700.bin

2、 <USG5300> startup system-software USG5300V200R001C00SPC800.bin  ##指定下次启动时使用的版本文件。

<USG5300> startup saved-configuration vrpcfg_new.cfg  ##指定下次启动时使用的配置文件,这个是可选配置

3、 display startup   ###验证配置

4、 使用reboot重启防火墙,执行reboot命令后,设备将会显示两次提示信息,询问是否继续,请您不保存配置重新启动。

5、 用户模式命令如果license可以通过命令加载license。系统视图命令:[USG5300]license file license.dat然后使用reboot命令重新启动系统,重新启动时请一定不要保存配置。

6、 加载补丁的方法:

1、在任意视图下,执行display patch-information,查看补丁信息。


2、如果没有补丁信息可以直接加载补丁;如果有补丁信息,需要先删除原有补丁再加载,示例如下:

 [USG5300] patch delete V300R001C10SPH101.pat

3加载补丁:[USG5300] patch load V300R001C10SPH102.pat

4激活补丁[USG5300] patch active V300R001C10SPH102.pat

5、运行补丁[USG5300] patch run V300R001C10SPH102.pat

2.6.2 使用图形界面升级

点击维护系统更新

wKiom1kQEE3x0ifxAACXTdBjtkE335.png-wh_50

 

选择需要更新的系统文件,点击导入


 wKioL1kQEGai2K4qAAAgS1x82aM065.png-wh_50

使用图形界面升级的时候,升级完成后不需要保存配置。直接重启就是。

 

用图形界面加载License的方法如下:选择License文件,然后点击激活。

wKiom1kQEHrRKOjwAABfo63jMxc910.png-wh_50

2.7 防火墙策略的配置

策略需求:

对于policy interzone trust dmz outbound之间的策略有以下需求:
1、源地址10.28.197.143访问所有的目的地址,服务全部开放。
2、源地址是所有的,目的地址是192.168.1.5192.168.1.6192.168.1.7开放8080804433389端口。
3、源地址是所有的访问目的地址是192.168.1.10192.168.1.11的服务全部开放。

这三个都要求开放icmp协议。

这里源为优先级高的10.28.197.X的trust,目的为优先级低的192.168.1.X的dmz

如果策略里不知道源和目的就是指any

配置方法:

ip service-set test1 type object        //创建自定义服务     

 service 0 protocol tcp destination-port 8080

 service 1 protocol tcp destination-port 3389

可以指定一个范围,比如:

 service 1 protocol tcp destination-port 8080 to 8090

 

ip service-set test type group   //创建服务组,可以将创建的自定义服务或者预定义的服务加到服务组里。

 service 0 service-set http

 service 1 service-set https

service 2 service-set icmp

service 3 service-set test1  //以上创建的自定义服务添加到服务组里

 

policy interzone trust dmz outbound  //配置域间包过滤策略,3个需求3policy策略

 policy 0 

 action permit 

 policy source 10.28.197.143 mask 255.255.255.255

 policy 1 

 action permit 

 policy service service-set test     //指定上面创建的服务

 policy destination 192.168.1.5 mask 255.255.255.255

 policy destination 192.168.1.6 mask 255.255.255.255

 policy destination 192.168.1.7 mask 255.255.255.255

 policy 2 

 action permit 

 policy destination 192.168.1.10 mask 255.255.255.255

 policy destination 192.168.1.11 mask 255.255.255.255

#

有地方还需要创建地址,方法如下

ip address-set ap type object   //创建地址集:

 address 0 192.168.100.62 mask 32   //一个单独地址

 address 1 range 18.0.6.55 18.0.6.255 //创建一个地址范围

类型objectgroup格式是一样的,只不过group地址里可以包含object和其他的group

wKioL1kQEKfiuxo4AAAoZEN2uaQ486.png-wh_50

ip address-set 生产网ip限制 type group  //创建地址组

address 0 address-set ap                               //可以包含以前的object

 address 1 range 18.0.7.0 18.0.7.255

 address 2 range 18.0.6.55 18.0.6.255

 address 3 range 18.0.5.0 18.0.5.255

 address 4 range 18.0.4.0 18.0.4.255    //一个地址范围,组里可以包含以前创建的地址或者组。

添加地址界面

wKioL1kQEMPRqCKcAAAtBJDxztE663.png-wh_50

创建的地址集或者地址组需要在策略里引用:

policy interzone trust dmz outbound

policy 1

policy destination address-set生产网ip限制

2.8 内部服务器映射

ip service-set video type object                 //增加自定义服务,做域间策略的时候引用

 service protocol tcp destination-port 10001 to 10007   //开启端口的范围

 service protocol tcp destination-port 9001

 service protocol tcp destination-port 3389

 service protocol tcp destination-port 1521

service protocol tcp destination-port 5060

service protocol udp destination-port 5060

ip service-set test_group type group             //增加自定义服务

 service 0 service-set http

 service 1 service-set telnet

 service 2 service-set video               //这个可以是自定义的服务

ip address-set address type object          //增加自定义IP地址

 address 192.168.5.123 0

 address 192.168.5.20 0

ip address-set test type group   //创建自定义IP地址组

address address-set address     //可以包含以前的地址object

address 192.168.5.123 0

 address range 18.0.7.0 18.0.7.255

 address range 18.0.6.55 18.0.6.255

 address range 18.0.5.0 18.0.5.255

policy interzone untrust dmz inbound

 policy 1

 action permit

 policy destination address-set test

policy service service-set icmp

 policy service service-set http

 policy service service-set video

nat server protocol udp global 218.84.3.174 5060 inside 192.168.5.123 5060

nat server protocol tcp global 218.84.3.174 5060 inside 192.168.5.123 5060

nat server protocol tcp global 218.84.3.174 10002 inside 192.168.5.123 10002

nat server protocol tcp global 218.84.3.174 10003 inside 192.168.5.123 10003

nat server protocol tcp global 218.84.3.174 10004 inside 192.168.5.123 10004

nat server protocol tcp global 218.84.3.174 10005 inside 192.168.5.123 10005

nat server protocol tcp global 218.84.3.174 10006 inside 192.168.5.123 10006

nat server protocol tcp global 218.84.3.174 10007 inside 192.168.5.123 10007

nat server protocol tcp global 218.84.3.174 80 inside 192.168.5.20 80

查看dis policy interzone

    Dis nat-policy

 

2.9 配置域内NAT,实现内网用户通过公网访问内部服务器

1、针对全局trust区域配置了nat server

nat address-group 1 192.168.0.1 192.168.0.1   比如防火墙trust接口地址为192.168.0.1地址池的地址无所谓,即使配置一个防火墙上不存在的地址也无所谓一般为了直观都用接口的ip地址。

#

nat server zone trust protocol tcp global 218.84.3.174 8090 inside 192.168.5.198 8080  //这个可以不用配置,直接用全局的也行,即不带zone的。这条必要配置

#

nat-policy zone trust

 policy 0

  action source-nat

  policy source 192.168.5.0 0.0.0.255   //内网网段可以不用指定,不指定代表any

  policy destination 192.168.1.123 0    //内部服务器可以不用指定,不指定代表any

  policy destination 192.168.1.198 0    //内部服务器,可以不用指定,不指定代表any

  address-group 1

#

ip route-static 192.168.0.1 32 NULL 0    //配置黑洞路由,避免形成路由环路,也可以不用配置,不正常的时候在配置。

2针对全局dmz区域配置了nat server,但是trust区域访问dmz内部服务器映射后的公网地址的配置。

nat address-group 2 172.18.200.250 172.18.200.250  //比如dmz接口的地址是172.18.200.250

nat-policy interzone trust dmz outbound

policy 0

  action source-nat

  address-group 2

如果要是想实现dmz通过trust映射后的地址访问内部服务器可以用以下命令

nat address-group 3 172.18.200.251 172.18.200.251  

nat-policy interzone dmz trust inbound

policy 0

  action source-nat

  address-group 3

 

2.10 配置策略路由

配置要求10.10.167.0218.201.135.17710.10.168.058.57.15.53

1、创建acl

acl number 3000

 rule 1 permit ip source 10.10.167.0 0.0.0.255

acl number 3001

 rule 1 permit ip source 10.10.168.0 0.0.0.255

 

2、创建策略路由

policy-based-route internet permit node 0

  if-match acl 3000

  apply ip-address next-hop 218.201.135.177

policy-based-route internet permit node 1

  if-match acl 3001

  apply ip-address next-hop 58.57.15.53

 

3、将策略路由引用到入接口(内网口)

 ip policy-based-route internet

 

4、配置默认路由,配置策略路由时候不需要配置明细路由。

 ip route-static 0.0.0.0 0.0.0.0 218.201.135.177

 ip route-static 0.0.0.0 0.0.0.0 58.57.15.53

 

检查配置:

dis policy-based-route

2.11双线接入时的路由配置


双线接入时必须选择等价路由配置到达相同目的地的多条路由,如果指定相同优先级,则可实现负载分担。此时,多条路由之间称为等价路由。

load-balance flow命令用来配置IP报文逐流负载分担。主要destination-ip destination-port  source-ip |source-port 相当于等价路由。

 


firewall packet-filter default permit interzone local trust direction inbound      //允许pingtrust,允许telnet trust接口,使能够访问trust接口,如果不加这条命令不能防火墙上pingtrust也不能telnet trust接口。所有的local与业务无关。

firewall packet-filter default permit interzone local trust direction outbound

firewall packet-filter default permit interzone local untrust direction inbound

firewall packet-filter default permit interzone local untrust direction outbound

firewall packet-filter default permit interzone local dmz direction inbound

firewall packet-filter default permit interzone local dmz direction outbound

 

 

配置内部服务器

V3版本通过acl指定,v5版本通过域间策略指定。

拓扑:Internet------USG2000------WEB服务器

要求:服务器及其内网通过NAT能访问Internet,服务器80端口对外发布网页

配置:

.NAT

acl number 2000
   rule 10 permit source 192.168.0.0 0.0.0.255

nat address-group 1 218.1.1.1 218.1.1.1

firewall interzone trust untrust
packet-filter 2000 outbound
   nat outbound 2000 address-group 1

2.外网访问服务器

acl number 3000
 rule 10 permit tcp destination 192.168.0.2 0 destination-port eq www

nat server protocol tcp global 218.1.1.1 www inside 192.168.0.2 www

firewall interzone trust untrust
packet-filter 3000 inbound

3.配置telnet

acl number 3002
 rule 10 permit ip destination 218.1.1.1 0

user-interface vty 0 4
 acl 3002 inbound

当内网部署了一台服务器,其真实IP是私网地址,但是希望公网用户可以通过一个公网地址来访问该服务器,这时可以配置NAT Server,使设备将公网用户访问该公网地址的报文自动转发给内网服务器。

前提条件

· 已经配置USG5300的工作模式(只能为路由模式,混合模式也是可以的)

· 已经配置接口IP地址

· 已经配置接口加入安全区域

· (可选)如果使用虚拟防火墙功能,需要已经创建***实例,并配置接口绑定***实例


spacer.gif说明:

当针对同一私网IP地址配置了NAT和内部服务器两个功能时,USG5300将优先根据内部服务器功能的配置进行地址转换。

操作步骤

1. 执行命令system-view,进入系统视图。

2. 选择执行以下命令之一,配置内部服务器。

对所有安全区域发布同一个公网IP,即这些安全区域的用户都可以通过访问同一个公网IP来访问内部服务器。



配置举例

当一个内部服务器需要对不同网段的外部用户提供服务时,多次执行带no-reverse参数的nat server命令,可以为一个内部服务器配置多个公网IP地址。此时,外部的不同网段用户可以通过访问不同的公网IP地址来访问此内部服务器。

1所示,例如服务器内部IP地址为1.1.1.1,其公网IP地址分别为2.2.2.2和3.3.3.3。



[USG5300] nat server protocol tcp global 2.2.2.2 ftp inside 1.1.1.1 ftp no-reverse

[USG5300] nat server protocol tcp global 3.3.3.3 ftp inside 1.1.1.1 ftp no-reverse

spacer.gif说明:

两次使用带no-reverse参数的nat server命令,为该内部服务器配置两个外部IP地址。

[USG5300] nat address-group 0 2.2.2.2 2.2.2.2

[USG5300] nat address-group 1 3.3.3.3 3.3.3.3

spacer.gif注意:

需要为不同的公网IP地址配置各自所属的不同的地址池。

[USG5300] nat-policy interzone dmz untrust outbound

[USG5300-nat-policy-interzone-dmz-untrust-outbound] policy 0

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] policy source 1.1.1.1 0

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] policy destination 2.0.0.0 mask 8

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] action source-nat

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] address-group 0

[USG5300-nat-policy-interzone-dmz-untrust-outbound-0] quit

[USG5300-nat-policy-interzone-dmz-untrust-outbound] policy 1

[USG5300-nat-policy-interzone-dmz-untrust-outbound-1] policy source 1.1.1.1 0

[USG5300-nat-policy-interzone-dmz-untrust-outbound-1] policy destination 3.0.0.0 mask 8

[USG5300-nat-policy-interzone-dmz-untrust-outbound-1] action source-nat

[USG5300-nat-policy-interzone-dmz-untrust-outbound-1] address-group 1

允许内部服务器访问外部不同网段的用户群或不同的安全区域时,需要配置不同的目的地址,使该内部服务器通过不同的公网IP地址访问。

内部服务器访问2.0.0.0/24网段时,内部服务器私网的IP地址转换为地址池0中的公网IP地址2.2.2.2。内部服务器访问3.0.0.0/24网段时,内部服务器私网的地址转换成地址池1中的公网IP地址3.3.3.3。由此可以配置内部服务器与用户群之间能相互访问。

 

 

 

 

 

 

 

 

 

1命令行配置方式:

配置整体限流策略,限制上网的总体最大上传/下载带宽均为100Mbps

整体上传限流

traffic-policy enable   //启用限流功能

#

car-class upload_class type shared   //配置整体限流Class名称为upload_class

 connection-number 2000  //限制连接数上限为2000一般上传不限制连接数。

 car 10000         //限制最大带宽为100Mbps,单位为kbps1Mbps1000kbps

#

 

//创建上传的限流策略,上传的方向是从TrustUntrust

traffic-policy interzone trust untrust outbound shared

  policy 0

  action car                                 //动作限流

  policy source 192.168.20.0 mask 24           //上传要指定源地址,目的地址是所有。

  policy car-class upload_class              //引用创建的限流class

#

整体下载限流

traffic-policy enable   //启用限流功能

#

car-class download_class type shared

car 10000

#

//创建下载的限流策略,上传的方向是从UntrustTrust

traffic-policy interzone trust untrust inbound shared

  policy 0

  action car                                 //动作限流

  policy destination 192.168.5.0 mask 24      //下载要指定目的地址,地址是所有。

  policy car-class download_class            //引用创建的限流class

#

 

 


 

 

 



 wKioL1kQEXyDd_8UAACSKdcZmvY946.png-wh_50

移动策略的优先级:域或者域内视图下。


 


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章