华为设备配置策略路由_策略路由

1. 创建VLAN并配置各接口

[LSW1]vlan batch 10 20 100

[LSW1-GigabitEthernet0/0/2]port link-type trunk

[LSW1-GigabitEthernet0/0/1]port trunk allow-pass vlan 10

[LSW1-GigabitEthernet0/0/1]port trunk pvid vlan 10

[LSW1-GigabitEthernet0/0/2]port link-type trunk  

[LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan 20

[LSW1-GigabitEthernet0/0/2]port trunk pvid vlan 20

[LSW1-GigabitEthernet0/0/3]port link-type trunk  

[LSW1-GigabitEthernet0/0/3]port trunk allow-pass vlan 100

[LSW1-GigabitEthernet0/0/3]port trunk pvid vlan 100

2. 配置各接口IP地址

[LSW1-Vlanif10]ip add 10.1.10.1 24  

[LSW1-Vlanif20]ip add 10.1.20.1 24

[LSW1-Vlanif100]ip add 10.1.100.1 24

[AR1-GigabitEthernet0/0/0]ip add 10.1.10.2 24

[AR2-GigabitEthernet0/0/0]ip add 10.1.20.2 24

华为设备配置策略路由_策略路由_02

华为设备配置策略路由_华为_03

3. 配置连通性

[LSW1]ospf 1

[LSW1-ospf-1]area 0

[LSW1-ospf-1-area-0.0.0.0]network  10.1.10.0 0.0.0.255

[LSW1-ospf-1-area-0.0.0.0]network 10.1.20.0 0.0.0.255

[LSW1-ospf-1-area-0.0.0.0]network 10.1.100.0 0.0.0.255

[AR1]ospf 1

[AR1-ospf-1]area 0

[AR1-ospf-1-area-0.0.0.0]network  10.1.10.0 0.0.0.255

[AR2]ospf 1

[AR2-ospf-1]area 0

[AR2-ospf-1-area-0.0.0.0]network  10.1.20.0 0.0.0.255

4. 配置ACL规则

[LSW1]acl 3001

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

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

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

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

[LSW1-acl-adv-3001]rule permit ip precedence 4

[LSW1]acl 3002                    

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

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

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

5. 配置流分类

[LSW1]traffic classifier a1

[LSW1-classifier-a1]if-match acl 3001

[LSW1]traffic classifier a2

[LSW1-classifier-a2]if-match acl 3002

[LSW1]traffic behavior b1

[LSW1-behavior-b1]redirect ip-nexthop 10.1.20.2

[LSW1]traffic behavior b2

[LSW1-behavior-b2]redirect ip-nexthop 10.1.10.2

6. 配置流行为

[LSW1]traffic policy c1

[LSW1-trafficpolicy-c1]classifier a1 behavior b1

[LSW1-trafficpolicy-c1]classifier a2 behavior b2

7. 配置流策略并应用到接口上

[LSW1-GigabitEthernet0/0/3]traffic-policy c1 inbound

8. 验证配置

华为设备配置策略路由_华为_04

华为设备配置策略路由_策略路由_05