<返回更多

华为策略路由配置实例

2019-11-07    
加入收藏

1、组网需求

华为策略路由配置实例

 

图1 策略路由组网示例图

如上图1所示,公司用户通过Switch双归属到外部网络设备。其中,一条是低速链路,网关为10.1.20.1/24;另外一条是高速链路,网关为10.1.30.1/24。

公司希望上送外部网络的报文中,IP优先级为4、5、6、7的报文通过高速链路传输,而IP优先级为0、1、2、3的报文则通过低速链路传输。

2、配置思路

1、创建VLAN并配置各接口,实现公司和外部网络设备互连。

2、配置ACL规则,分别匹配IP优先级4、5、6、7,以及IP优先级0、1、2、3。

3、配置流分类,匹配规则为上述ACL规则,使设备可以对报文进行区分。

4、配置流行为,使满足不同规则的报文分别被重定向到10.1.20.1/24和10.1.30.1/24。

5、配置流策略,绑定上述流分类和流行为,并应用到接口GE2/0/1的入方向上,实现策略路由。

3、操作步骤

3.1、创建VLAN并配置各接口

# 在Switch上创建VLAN100和VLAN200。

<HUAWEI> system-view

[HUAWEI] sysname Switch

[Switch] vlan batch 100 200

# 配置Switch上接口GE1/0/1、GE1/0/2和GE2/0/1的接口类型为Trunk,并加入VLAN100和VLAN200。

[Switch] interface gigabitethernet 1/0/1

[Switch-GigabitEthernet1/0/1] port link-type trunk

[Switch-GigabitEthernet1/0/1] port trunk allow-pass vlan 100 200

[Switch-GigabitEthernet1/0/1] quit

[Switch] interface gigabitethernet 1/0/2

[Switch-GigabitEthernet1/0/2] port link-type trunk

[Switch-GigabitEthernet1/0/2] port trunk allow-pass vlan 100 200

[Switch-GigabitEthernet1/0/2] quit

[Switch] interface gigabitethernet 2/0/1

[Switch-GigabitEthernet2/0/1] port link-type trunk

[Switch-GigabitEthernet2/0/1] port trunk allow-pass vlan 100 200

[Switch-GigabitEthernet2/0/1] quit

配置LSW与Switch对接的接口为Trunk类型接口,并加入VLAN100和VLAN200。

# 创建VLANIF100和VLANIF200,并配置各虚拟接口IP地址。

[Switch] interface vlanif 100

[Switch-Vlanif100] ip address 10.1.20.2 24

[Switch-Vlanif100] quit

[Switch] interface vlanif 200

[Switch-Vlanif200] ip address 10.1.30.2 24

[Switch-Vlanif200] quit

3.2、配置ACL规则

# 在Switch上创建编码为3001、3002的高级ACL,规则分别为允许IP优先级0、1、2、3和允许IP优先级4、5、6、7的报文通过。

[Switch] acl 3001

[Switch-acl-adv-3001] rule permit ip precedence 0

[Switch-acl-adv-3001] rule permit ip precedence 1

[Switch-acl-adv-3001] rule permit ip precedence 2

[Switch-acl-adv-3001] rule permit ip precedence 3

[Switch-acl-adv-3001] quit

[Switch] acl 3002

[Switch-acl-adv-3002] rule permit ip precedence 4

[Switch-acl-adv-3002] rule permit ip precedence 5

[Switch-acl-adv-3002] rule permit ip precedence 6

[Switch-acl-adv-3002] rule permit ip precedence 7

[Switch-acl-adv-3002] quit

3.3、配置流分类

在Switch上创建流分类c1、c2,匹配规则分别为ACL 3001和ACL 3002。

[Switch] traffic classifier c1 operator and

[Switch-classifier-c1] if-match acl 3001

[Switch-classifier-c1] quit

[Switch] traffic classifier c2 operator and

[Switch-classifier-c2] if-match acl 3002

[Switch-classifier-c2] quit

3.4、配置流行为

# 在Switch上创建流行为b1、b2,并分别指定重定向到网段10.1.20.1/24和10.1.30.1/24的动作。

[Switch] traffic behavior b1

[Switch-behavior-b1] redirect ip-nexthop 10.1.20.1

[Switch-behavior-b1] quit

[Switch] traffic behavior b2

[Switch-behavior-b2] redirect ip-nexthop 10.1.30.1

[Switch-behavior-b2] quit

3.5、配置流策略并应用到接口上

# 在Switch上创建流策略p1,将流分类和对应的流行为进行绑定。

[Switch] traffic policy p1

[Switch-trafficpolicy-p1] classifier c1 behavior b1

[Switch-trafficpolicy-p1] classifier c2 behavior b2

[Switch-trafficpolicy-p1] quit

# 将流策略p1应用到接口GE2/0/1的入方向上。

[Switch] interface gigabitethernet 2/0/1

[Switch-GigabitEthernet2/0/1] traffic-policy p1 inbound

[Switch-GigabitEthernet2/0/1] return

3.6、验证配置结果

# 查看ACL规则的配置信息。

<Switch> display acl 3001

Advanced ACL 3001, 4 rules

Acl's step is 5

rule 5 permit ip precedence routine (match-counter 0)

rule 10 permit ip precedence priority (match-counter 0)

rule 15 permit ip precedence immediate (match-counter 0)

rule 20 permit ip precedence flash (match-counter 0)

<Switch> display acl 3002

Advanced ACL 3002, 4 rules

Acl's step is 5

rule 5 permit ip precedence flash-override (match-counter 0)

rule 10 permit ip precedence critical (match-counter 0)

rule 15 permit ip precedence internet (match-counter 0)

rule 20 permit ip precedence network (match-counter 0)

# 查看流分类的配置信息。

<Switch> display traffic classifier user-defined

User Defined Classifier Information:

Classifier: c1

Precedence: 5

Operator: AND

Rule(s) : if-match acl 3001

Classifier: c2

Precedence: 10

Operator: AND

Rule(s) :if-match acl 3002

Total classifier number is 2

# 查看流策略的配置信息。

<Switch> display traffic policy user-defined p1

User Defined Traffic Policy Information:

Policy: p1

Classifier: c1

Operator: AND

Behavior: b1

Redirect: no forced

Redirect ip-nexthop

10.1.20.1

Classifier: c2

Operator: AND

Behavior: b2

Redirect: no forced

Redirect ip-nexthop

10.1.30.1

4、配置文件

Switch的配置文件

#

sysname Switch

#

vlan batch 100 200

#

acl number 3001

rule 5 permit ip precedence routine

rule 10 permit ip precedence priority

rule 15 permit ip precedence immediate

rule 20 permit ip precedence flash

#

acl number 3002

rule 5 permit ip precedence flash-override

rule 10 permit ip precedence critical

rule 15 permit ip precedence internet

rule 20 permit ip precedence network

#

traffic classifier c1 operator and precedence 5

if-match acl 3001

traffic classifier c2 operator and precedence 10

if-match acl 3002

#

traffic behavior b1

redirect ip-nexthop 10.1.20.1

traffic behavior b2

redirect ip-nexthop 10.1.30.1

#

traffic policy p1 match-order config

classifier c1 behavior b1

classifier c2 behavior b2

#

interface Vlanif100

ip address 10.1.20.2 255.255.255.0

#

interface Vlanif200

ip address 10.1.30.2 255.255.255.0

#

interface GigabitEthernet1/0/1

port link-type trunk

port trunk allow-pass vlan 100 200

#

interface GigabitEthernet1/0/2

port link-type trunk

port trunk allow-pass vlan 100 200

#

interface GigabitEthernet2/0/1

port link-type trunk

port trunk allow-pass vlan 100 200

traffic-policy p1 inbound

#

return

声明:本站部分内容来自互联网,如有版权侵犯或其他问题请与我们联系,我们将立即删除或处理。
▍相关推荐
更多资讯 >>>