赞
踩
为了保证企业内网的安全,通过配置策略路由将外网到内网的全部流量引流防火墙进行安全检测。
组网需求
如图1所示,某公司由于业务需要,用户有访问Internet的需求。用户通过核心交换机SwitchA以及接入网关Router与Internet进行通信。
为了保证公司网络的安全性,将所有进入公司内网的流量引入到旁挂防火墙进行安全检测后再进入公司内部网络。
配置思路
说明:
本案例只介绍交换机的配置,防火墙的配置请参见相关手册。
操作步骤
# 配置SwitchA各接口IP地址。缺省情况下,交换机的接口为二层接口,在配置IP地址之前,请先使用undo portswitch命令将接口切换为三层接口。
- <HUAWEI> system-view
- [HUAWEI] sysname SwitchA
- [SwitchA] interface gigabitethernet 1/0/1
- [SwitchA-GigabitEthernet1/0/1] undo portswitch
- [SwitchA-GigabitEthernet1/0/1] ip address 10.1.1.2 24
- [SwitchA-GigabitEthernet1/0/1] quit
- [SwitchA] interface gigabitethernet 1/0/2
- [SwitchA-GigabitEthernet1/0/2] undo portswitch
- [SwitchA-GigabitEthernet1/0/2] ip address 10.1.20.1 24
- [SwitchA-GigabitEthernet1/0/2] quit
- [SwitchA] interface gigabitethernet 1/0/3
- [SwitchA-GigabitEthernet1/0/3] undo portswitch
- [SwitchA-GigabitEthernet1/0/3] ip address 10.1.10.6 24
- [SwitchA-GigabitEthernet1/0/3] quit
- [SwitchA] interface gigabitethernet 1/0/4
- [SwitchA-GigabitEthernet1/0/4] undo portswitch
- [SwitchA-GigabitEthernet1/0/4] ip address 10.1.11.6 24
- [SwitchA-GigabitEthernet1/0/4] quit
# 在SwitchA上配置路由协议,保证三层互通,这里选取OSPF协议。
防火墙上一般会配置两个OSPF进程分别发布上行和下行的网段,所以在SwitchA上也需要配置两个OSPF进程。
- [SwitchA] ospf 100
- [SwitchA-ospf-100] area 0
- [SwitchA-ospf-100-area-0.0.0.0] network 10.1.1.0 0.0.0.255
- [SwitchA-ospf-100-area-0.0.0.0] network 10.1.10.0 0.0.0.255
- [SwitchA-ospf-100-area-0.0.0.0] quit
- [SwitchA-ospf-100] quit
- [SwitchA] ospf 200
- [SwitchA-ospf-200] area 0
- [SwitchA-ospf-200-area-0.0.0.0] network 10.1.11.0 0.0.0.255
- [SwitchA-ospf-200-area-0.0.0.0] network 10.1.20.0 0.0.0.255
- [SwitchA-ospf-200-area-0.0.0.0] quit
- [SwitchA-ospf-200] quit
# 配置流分类,匹配所有流量。
- [SwitchA] traffic classifier c1
- [SwitchA-classifier-c1] if-match any
- [SwitchA-classifier-c1] quit
# 配置流行为,将匹配到的流量重定向到防火墙,下一跳IP地址为10.1.10.5。 - [SwitchA] traffic behavior b1
- [SwitchA-behavior-b1] redirect ip-nexthop 10.1.10.5
- [SwitchA-behavior-b1] quit
# 配置流策略。 - [SwitchA] traffic policy p1
- [SwitchA-trafficpolicy-p1] classifier c1 behavior b1
- [SwitchA-trafficpolicy-p1] quit
# 在SwitchA的GigabitEthernet1/0/1入方向应用流策略。 - [SwitchA] interface gigabitethernet 1/0/1
- [SwitchA-GigabitEthernet1/0/1] traffic-policy p1 inbound
- [SwitchA-GigabitEthernet1/0/1] quit
- [SwitchA] quit
# 查看流分类的配置信息。
- <SwitchA> display traffic classifier user-defined c1
- User Defined Classifier Information:
- Classifier: c1
- Precedence: 5
- Operator: OR
- Rule(s) : if-match any
# 查看流行为的配置信息。
- <SwitchA> display traffic behavior user-defined b1
- User Defined Behavior Information:
- Behavior: b1
- Permit
- Redirect: no forced
- Redirect ip-nexthop
- 10.1.10.5
# 查看流策略的配置信息。
- <SwitchA> display traffic policy user-defined p1
- User Defined Traffic Policy Information:
- Policy: p1
- Classifier: c1
- Operator: OR
- Behavior: b1
- Permit
- Redirect: no forced
- Redirect ip-nexthop
- 10.1.10.5
# 查看流策略的应用信息。
- <SwitchA> display traffic-policy applied-record
- #
- -------------------------------------------------
- Policy Name: p1
- Policy Index: 0
- Classifier:c1 Behavior:b1
- -------------------------------------------------
- *interface GigabitEthernet1/0/1
- traffic-policy p1 inbound
- slot 1 : success
- -------------------------------------------------
- Policy total applied times: 1.
- #
配置文件
SwitchA的配置文件
# sysname SwitchA # traffic classifier c1 operator or precedence 5 if-match any # traffic behavior b1 permit redirect ip-nexthop 10.1.10.5 # traffic policy p1 match-order config classifier c1 behavior b1 # interface GigabitEthernet1/0/1 undo portswitch ip address 10.1.1.2 255.255.255.0 traffic-policy p1 inbound # interface GigabitEthernet1/0/2 undo portswitch ip address 10.1.20.1 255.255.255.0 # interface GigabitEthernet1/0/3 undo portswitch ip address 10.1.10.6 255.255.255.0 # interface GigabitEthernet1/0/4 undo portswitch ip address 10.1.11.6 255.255.255.0 # ospf 100 area 0.0.0.0 network 10.1.1.0 0.0.0.255 network 10.1.10.0 0.0.0.255 # ospf 200 area 0.0.0.0 network 10.1.11.0 0.0.0.255 network 10.1.20.0 0.0.0.255 # return
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。