-
创建VLAN并配置各接口
[LSW1]vlan batch 11 12 100
[LSW1-GigabitEthernet0/0/1]port link-type access
[LSW1-GigabitEthernet0/0/1]port default vlan 11
[LSW1-GigabitEthernet0/0/3]port link-type access
[LSW1-GigabitEthernet0/0/3]port default vlan 12
[LSW1-GigabitEthernet0/0/2]port link-type trunk
[LSW1-GigabitEthernet0/0/2]port trunk allow-pass vlan all
[LSW1-GigabitEthernet0/0/2]port trunk pvid vlan 100
[LSW2]vlan batch 10 20 100
[LSW2-GigabitEthernet0/0/1]port link-type trunk
[LSW2-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20 100
[LSW2-GigabitEthernet0/0/1]port trunk pvid vlan 100
[LSW2-GigabitEthernet0/0/2]port link-type trunk
[LSW2-GigabitEthernet0/0/2]port trunk allow-pass vlan
[LSW2-GigabitEthernet0/0/2]port trunk allow-pass vlan 10
20 100
[LSW2-GigabitEthernet0/0/2]port trunk pvid vlan 20
[LSW2-GigabitEthernet0/0/3]port link-type trunk
[LSW2-GigabitEthernet0/0/3]port trunk allow-pass vlan 10 20 100
[LSW2-GigabitEthernet0/0/3]port trunk pvid vlan 10 -
配置各接口IP地址
[LSW1-Vlanif11]ip add 10.1.11.1 24
[LSW1-Vlanif12]ip add 10.1.12.1 24
[LSW1-Vlanif100]ip add 10.1.100.1 24
[LSW2-Vlanif10]ip add 10.1.10.2 24
[LSW2-Vlanif20]ip add 10.1.20.2 24
[LSW2-Vlanif100]ip add 10.1.100.2 24
[AR1-GigabitEthernet0/0/0]ip add 10.1.10.1 24
[AR2-GigabitEthernet0/0/0]ip add 10.1.20.1 24
-
配置网络连通性
[LSW1]ip route-static 0.0.0.0 0.0.0.0 10.1.100.2
[LSW2]ip route-static 10.1.11.0 255.255.255.0 10.1.100.1
[LSW2]ip route-static 10.1.12.0 255.255.255.0 10.1.100.1
[LSW2]ospf 1
[LSW2-ospf-1]area 0
[LSW2-ospf-1-area-0.0.0.0]network 10.1.10.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.0]network 10.1.20.0 0.0.0.255
[LSW2-ospf-1-area-0.0.0.0]network 10.1.100.0 0.0.0.255
[LSW2-ospf-1]import-route static
[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
-
配置ACL规则
[LSW2-acl-adv-3001]rule 1 permit ip source 10.1.11.0 0.0.0.255
[LSW2-acl-adv-3002]rule 1 permit ip source 10.1.12.0 0.0.0.255 -
配置流分类
[LSW2]traffic classifier a1
[LSW2-classifier-a1]if-match acl 3001
[LSW2]traffic classifier a2
[LSW2-classifier-a2]if-match acl 3002 -
配置流行为
[LSW2]traffic behavior b1
[LSW2-behavior-b1]redirect ip-nexthop 10.1.10.1
[LSW2]traffic behavior b2
[LSW2-behavior-b2]redirect ip-nexthop 10.1.20.1 -
配置流策略并应用到接口上
[LSW2]traffic policy c1
[LSW2-trafficpolicy-c1]classifier a1 behavior b1
[LSW2-trafficpolicy-c1]classifier a2 behavior b2
[LSW2-GigabitEthernet0/0/1]traffic-policy c1 inbound -
验证配置
华为设备配置基于IP地址策略路由
最新推荐文章于 2024-06-11 09:13:17 发布