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。
system-view
[huawei]sysname switch
[switch]vlan batch 100 200
#配置switch上介面ge1/0/1、ge1/0/2和ge2/0/1的介面型別為trunk,並加入vlan100和vlan200。
[switch]inte***ce 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]inte***ce 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]inte***ce 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]inte***ce vlanif 100
[switch-vlanif100]ip address 10.1.20.2 24
[switch-vlanif100]quit
[switch]inte***ce 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 beh**ior b1
[switch-beh**ior-b1]redirect ip-nexthop 10.1.20.1
[switch-beh**ior-b1]quit
[switch]traffic beh**ior b2
[switch-beh**ior-b2]redirect ip-nexthop 10.1.30.1
[switch-beh**ior-b2]quit
3.5、配置流策略並應用到介面上
#在switch上建立流策略p1,將流分類和對應的流行為進行繫結。
[switch]traffic policy p1
[switch-trafficpolicy-p1]classifier c1 beh**ior b1
[switch-trafficpolicy-p1]classifier c2 beh**ior b2
[switch-trafficpolicy-p1]quit
#將流策略p1應用到介面ge2/0/1的入方向上。
[switch]inte***ce gigabitethernet 2/0/1
[switch-gigabitethernet2/0/1]traffic-policy p1 inbound
[switch-gigabitethernet2/0/1]return
3.6、驗證配置結果
#檢視acl規則的配置資訊。
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)
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)
#檢視流分類的配置資訊。
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
#檢視流策略的配置資訊。
display traffic policy user-defined p1
user defined traffic policy information:
policy: p1
classifier: c1
operator: and
beh**ior: b1
redirect: no forced
redirect ip-nexthop
10.1.20.1
華為路由交換配置命令大全
配置命令 檢視當前的版本命令是 display version 重新啟動系統 reboot 時間設定檢視時間 display clock 時間配置例 clock timezone beijing add 8 00 設定時區 clock datetime 15 21 2005 09 05 設定時間和日...
華為路由器配置命令大全
一 access list 用於建立訪問規則。1 建立標準訪問列表 access list normal special listnumber1 source addr source mask 2 建立擴充套件訪問列表 access list normal special listnumber2 p...
路由器NAT配置例項詳解
路由器nat功能配置簡介 隨著internet的網路迅速發展,ip位址短缺已成為乙個十分突出的問題。為了解決這個問題,出現了多種解決方案。下面幾紹一種在目前網路環境中比較有效的方法即位址轉換 nat 功能。一 nat簡介 nat network address translation 的功能,就是指...