华为策略路由配置实例
首页 > HuaWei > 路由配置   作者:圈哥  2016年6月9日 12:02 星期四  热度:2426°  字号:   评论:2 条
时间:2016-6-9 12:02   热度:2426°  评论:2 条 

华为策略路由配置实例

1、组网需求

    策略路由组网示例图.png

                 1 策略路由组网示例图

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

    公司希望上送外部网络的报文中,IP优先级为4567的报文通过高速链路传输,而IP优先级为0123的报文则通过低速链路传输。

 

2、配置思路

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

2、配置ACL规则,分别匹配IP优先级4567,以及IP优先级0123

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

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

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

 

3、操作步骤

3.1、创建VLAN并配置各接口

# Switch上创建VLAN100VLAN200

<HUAWEI> system-view

[HUAWEI] sysname Switch

[Switch] vlan batch 100 200

 

# 配置Switch上接口GE1/0/1GE1/0/2GE2/0/1的接口类型为Trunk,并加入VLAN100VLAN200

[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

配置LSWSwitch对接的接口为Trunk类型接口,并加入VLAN100VLAN200

 

# 创建VLANIF100VLANIF200,并配置各虚拟接口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上创建编码为30013002的高级ACL,规则分别为允许IP优先级0123和允许IP优先级4567的报文通过。

[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上创建流分类c1c2,匹配规则分别为ACL 3001ACL 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上创建流行为b1b2,并分别指定重定向到网段10.1.20.1/2410.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

 您阅读这篇文章共花了: 
捐赠支持:如果觉得这篇文章对您有帮助,请“扫一扫”鼓励作者!
二维码加载中...
技术交流:欢迎在本文下方留言或加入QQ群:481294053/474079428 互相学习。     
本文地址:http://www.023wg.com/lypz/270.html
版权声明:若无注明,本文皆为“重庆网管”原创,转载请保留文章出处。
凝结水回收2016-06-09 15:26
听君一席话,胜读十年书.欢迎朋友回访交流!
蒸汽回收机2016-06-09 15:25
博主分享的精准到位,本人受益匪浅,非常感谢!欢迎朋友回访交流!

返回顶部    首页    捐赠支持   
版权所有:重庆网管    圈哥