防火墙技术案例3 - 校园网出口网关配置 联系客服

发布时间 : 星期一 文章防火墙技术案例3 - 校园网出口网关配置更新完毕开始阅读72e0a7c6482fb4daa48d4b9a

【防火墙技术案例3】强叔拍案惊奇 校园网出口网关配置

论坛的小伙伴们,大家好。强叔刚刚从某著名高校开局归来,气儿还没喘匀,就为大家伏案写下这篇经典的校园网出口网关配置。墨迹未干,就此奉上~

这篇案例来源于此次开局的真实组网,是真实组网的“微缩改造”版。但这丝毫不影响这篇案例的真实性和实用性,各位准备部署校园网出口网关的小伙伴们可以尽情参考噢~

——————————本案例很长,但看完一定会有收获—————————————— 【组网需求】

如图所示,防火墙(USG9560 V300R001C20版本)作为网关部署在学校网络出口。

学校的具体需求如下:

1、 为了保证内网用户的上网体验,学校希望去往特定目的地址的流量能够通过特定的ISP链路转发。例如,去往ISP1的服务器的流量能够通过ISP1提供的链路转发,去往ISP2的服务器的流量能够通过ISP2提供的链路转发,去往教育网服务器的流量能够通过教育网链路转发。

另外学校希望特定内网用户的流量能够通过特定的ISP链路转发。例如图书馆的上网流量能够通过教育网链路转发。

2、 学校内部署了提供对外访问的服务器,供多个ISP的用户访问。例如学校网站主页、邮件、Portal等服务器。

学校内还部署了DNS服务器为以上服务器提供域名解析。学校希望各ISP的外网用户能够解析到自己ISP的地址,从而提高访问服务器的速度。

3、 学校希望USG能够保护内部网络,防止SYN-flood攻击,并对网络入侵行为进行告警。 4、 学校希望限制P2P流量,包括每个用户的P2P流量,以及网络总体的P2P流量。

5、 学校希望能够在网管系统上查看攻击防范和入侵检测的日志,并且能够查看NAT转换前后的IP地址。 【配置步骤】

1、配置各接口的IP地址。

接口的配置我想大家都会的,所以强叔这里只给出GE1/0/0的配置了。本举例中的接口都为10GE接口。 【强叔点评】一般ISP分配给你的IP地址都是30位掩码的。建议在接口上配置描述或别名,表示接口的情况。

system-view

[USG] interface GigabitEthernet 1/0/0

[USG -GigabitEthernet1/0/0] ip address 218.1.1.1 255.255.255.252 [USG -GigabitEthernet1/0/0] description tocernet [USG -GigabitEthernet1/0/0] quit

2、创建安全区域,并将各接口加入安全区域。

新建安全区域isp1、isp2和cernet(代表教育网),并将各接口加入对应的安全区域。

【强叔点评】当防火墙需要连接多个ISP时,一般需要为每个连接ISP的接口都创建一个新的安全区域,而且安全区域的名称最好能够代表此安全区域。 [USG] firewall zone name isp1 [USG-zone-isp1] set priority 15

[USG-zone-isp1] add interface GigabitEthernet 1/0/1 [USG-zone-isp1] quit

[USG] firewall zone name isp2 [USG-zone-isp2] set priority 20

[USG-zone-isp2] add interface GigabitEthernet 1/0/2 [USG-zone-isp2] quit

[USG] firewall zone name cernet [USG-zone-cernet] set priority 25

[USG-zone-cernet] add interface GigabitEthernet 1/0/0 [USG-zone-cernet] quit [USG] firewall zone trust

[USG-zone- trust] add interface GigabitEthernet 1/0/3 [USG-zone- trust] quit

3、配置IP-Link,探测各ISP提供的链路状态是否正常。 [USG] ip-link check enable

[USG] ip-link 1 destination 218.1.1.2 interface GigabitEthernet1/0/0 [USG] ip-link 2 destination 200.1.1.2 interface GigabitEthernet1/0/1 [USG] ip-link 3 destination 202.1.1.2 interface GigabitEthernet1/0/2

【强叔点评】当IP-Link监控的链路故障时,与其绑定的静态路由或策略路由失效。 4、配置静态路由,保证基础路由可达。

配置缺省路由,下一跳为教育网的地址,保证未匹配其他路由的流量都能够通过教育网转发出去。 [USG] ip route-static 0.0.0.0 0.0.0.0 218.1.1.1

配置静态路由,目的地址为内网网段,下一跳为内网交换机的地址,保证外网的流量能够到达内网。 [USG] ip route-static 10.1.0.0 255.255.0.0 172.16.1.2

【强叔点评】当在网关上配置静态路由时,既要有出方向的路由,也要有入方向的路由。一般情况下,出方向都会至少配置一条缺省路由。

5、 配置ISP选路,保证去往特定目的地址的流量能够通过特定链路(接口)转发。 1) 从各ISP获取最新的目的地址明细。 2) 按如下格式分别编辑各ISP的csv文件。

3) 导入所有ISP的csv文件。

4) 执行以下命令,分部加载各ISP的csv文件,并指定下一跳。

[USG] isp set filename csnet.csv GigabitEthernet 1/0/0 next-hop 218.1.1.2 track ip-link 1 [USG] isp set filename isp1.csv GigabitEthernet 1/0/1 next-hop 200.1.1.2 track ip-link 2 [USG] isp set filename isp2.csv GigabitEthernet 1/0/2 next-hop 202.1.1.2 track ip-link 3

【强叔点评】ISP选路功能其实就是批量下发明细路由,目的地址为ISP文件中的地址,下一跳为配置命令指定的地址。ISP选路能够实现去往特定ISP目的地址的流量都通过对应的ISP链路转发。 各位小伙伴注意,ISP选路功能是USG9000系列V300R001C20版本的新功能噢。 6、配置策略路由,保证特定内网用户(IP)的流量能够通过特定链路(接口)转发。

【强叔点评】策略路由的作用是基于源IP地址的选路(当然通过高级ACL也能实现基于目的地址的选路)。例如图书管的上网用户(10.1.2.0/24网段)只能通过教育网访问Internet。策略路由的配置方式是华为经典的CB对(classifier和behavior配对)配置方式。 [USG] acl number 2000

[USG-acl-basic-2000] rule permit source 10.1.2.0 0.0.0.255 [USG-acl-basic-2000] quit [USG] traffic classifier classlb

[USG-classifier-classlb] if-match acl 2000 [USG-classifier-classlb] quit [USG] traffic behavior behaviorlb

[USG-behavior-behaviorlb] redirect ip-nexthop 218.1.1.2 interface GigabitEthernet 1/0/0 track ip-link 1

[USG-behavior-behaviorlb] quit [USG] traffic policy policylb

[USG-trafficpolicy-policylb] classifier classlb behavior behaviorlb [USG-trafficpolicy-policylb] quit [USG] interface GigabitEthernet 1/0/3

[USG-GigabitEthernet1/0/3] traffic-policy policylb inbound [USG-GigabitEthernet1/0/3] quit

7、配置安全策略和IPS,保证流量能够正常转发的同时,进行入侵行为检测。

开启trust与isp1、isp2、csnet间的安全策略,并引用缺省的配置文件ids,进行入侵行为检测。下面仅以trust与isp1间的安全策略配置为例。 [USG] policy interzone trust isp1 outbound

[USG-policy-interzone-trust-isp1-outbound] policy 0 [USG-policy-interzone-trust-isp1-outbound-0] action permit [USG-policy-interzone-trust-isp1-outbound-0] profile ips ids [USG-policy-interzone-trust-isp1-outbound-0] quit [USG] policy interzone trust isp1 inbound

[USG-policy-interzone-trust-isp1- inbound] policy 0 [USG-policy-interzone-trust-isp1- inbound -0] action permit [USG-policy-interzone-trust-isp1- inbound -0] profile ips ids [USG-policy-interzone-trust-isp1- inbound -0] quit 启用IPS功能,并配置特征库定时在线升级。 [USG] ips enable

[USG] update schedule ips-sdb enable [USG] update schedule weekly sun 02:00 [USG] update schedule sa-sdb enable [USG] update schedule weekly sun 03:00 [USG] undo update confirm ips-sdb enable [USG] undo update confirm sa-sdb enable

【强叔点评】当防火墙作网关且网络对安全性要求不高时,可以配置域间的安全策略动作为允许。通过在安全策略上引用入侵防御配置文件可以实现安全区域间流量的入侵防御。USG缺省存在配置文件default和ids。配置文件default用于入侵行为检测并阻断,配置文件ids用于入侵行为检测并告警(不阻断)。 8、配置源NAT,保证多个内网用户能够同时访问外网。

需要分别在trust与isp1、isp2、csnet间配置源NAT,下面仅以trust与isp1间的源NAT配置为例。NAT地址池中的地址是从ISP获取的。 [USG] nat address-group isp1 [USG-address-group- isp1] mode pat

[USG-address-group- isp1] section 200.1.1.10 200.1.1.12 [USG-address-group- isp1] quit

[USG] nat-policy interzone trust isp1 outbound

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

[USG-nat-policy-interzone-trust-isp1-outbound-0] action source-nat [USG-nat-policy-interzone-trust-isp1-outbound-0] address-group isp1 [USG] ip route-static 200.1.1.10 32 NULL 0 [USG] ip route-static 200.1.1.11 32 NULL 0 [USG] ip route-static 200.1.1.12 32 NULL 0

【强叔点评】源NAT和NAT Server都必须配置黑洞路由。