更新时间:2023-04-20 GMT+08:00
分享

配置交换机

  1. 配置接口。

    1. 配置接口GigabitEthernet 1/0/21。
      [HUAWEI] interface gigabitethernet 1/0/21
      [HUAWEI-GigabitEthernet1/0/21] undo portswitch
      [HUAWEI-GigabitEthernet1/0/21] ip address 10.1.10.2 24
      [HUAWEI-GigabitEthernet1/0/21] quit
    2. 配置接口GigabitEthernet 1/0/20。
      [HUAWEI] interface gigabitethernet 1/0/20
      [HUAWEI-GigabitEthernet1/0/20] undo portswitch
      [HUAWEI-GigabitEthernet1/0/20] ip address 10.2.10.2 24
      [HUAWEI-GigabitEthernet1/0/20] quit
    3. 配置GigabitEthernet 0/0/21
      [HUAWEI] interface gigabitethernet 0/0/21
      [HUAWEI-GigabitEthernet0/0/21] undo portswitch
      [HUAWEI-GigabitEthernet0/0/21] ip address 10.6.10.2 24
      [HUAWEI-GigabitEthernet0/0/21] quit
    4. 配置GigabitEthernet 0/0/20
      [HUAWEI] interface gigabitethernet 0/0/20
      [HUAWEI-GigabitEthernet0/0/20] undo portswitch
      [HUAWEI-GigabitEthernet0/0/20] ip address 10.7.10.2 24
      [HUAWEI-GigabitEthernet0/0/20] quit
    5. 配置下行口eth-trunk。
      [HUAWEI] interface eth-trunk 1
      [HUAWEI-eth-trunk1] trunkport gigabitethernet 0/0/12
      [HUAWEI-eth-trunk1] trunkport gigabitethernet 1/0/12
      [HUAWEI-eth-trunk1] ip address 10.5.0.1 24
      [HUAWEI-eth-trunk1] quit
    6. 配置上行口Vlanif10。
      [HUAWEI] vlan 10
      [HUAWEI-vlan10] quit
      [HUAWEI] interface gigabitethernet 1/0/16
      [HUAWEI-GigabitEthernet1/0/6] port link-type access
      [HUAWEI-GigabitEthernet1/0/6] port default vlan 10
      [HUAWEI-GigabitEthernet1/0/6] quit
      [HUAWEI] interface gigabitethernet 0/0/16
      [HUAWEI-GigabitEthernet0/0/6] port link-type access
      [HUAWEI-GigabitEthernet0/0/6] port default vlan 10
      [HUAWEI-GigabitEthernet0/0/6] quit
      [HUAWEI] interface vlanif 10
      [HUAWEI-vlanif10] ip address 10.3.0.4 24
      [HUAWEI-vlanif10] quit

  2. 配置上行口策略路由。

    1. 配置ACL规则3000、 流分类c10_up_to_down、 流行为b10_up_to_down。
      [HUAWEI] acl number 3000
      [HUAWEI-acl-adv-3000] rule 10 permit ip
      [HUAWEI-acl-adv-3000] quit
      [HUAWE] traffic classifier c10_up_to_down
      [HUAWEI-classifier-c10_up_to_down] if-match acl 3000
      [HUAWEI-classifier-c10_up_to_down] quit
      [HUAWEI] traffic behavior b10_up_to_down
      [HUAWEI-behavior-b10_up_to_down] redirect ip-nexthop 10.1.10.21 10.6.10.21
      [HUAWEI-behavior-b10_up_to_down] quit
    2. 配置ACL规则3003、 流分类tianguan1、 流行为tianguan1。
      [HUAWEI] acl number 3003
      [HUAWEI-acl-adv-3003] rule 10 permit ip destination 10.1.10.21 0
      [HUAWEI-acl-adv-3003] quit
      [HUAWE] traffic classifier tianguan1
      [HUAWEI-classifier-tianguan1] if-match acl 3003
      [HUAWEI-classifier-tianguan1] quit
      [HUAWEI] traffic behavior tianguan1
      [HUAWEI-behavior-tianguan1] redirect ip-nexthop 10.1.10.21
      [HUAWEI-behavior-tianguan1] quit
    3. 配置ACL规则3004、 流分类tianguan2、 流行为tianguan2。
      [HUAWEI] acl number 3004
      [HUAWEI-acl-adv-3004] rule 10 permit ip destination 10.6.10.21 0
      [HUAWEI-acl-adv-3004] quit
      [HUAWE] traffic classifier tianguan2
      [HUAWEI-classifier-tianguan2] if-match acl 3004
      [HUAWEI-classifier-tianguan2] quit
      [HUAWEI] traffic behavior tianguan2
      [HUAWEI-behavior-tianguan2] redirect ip-nexthop 10.6.10.21
      [HUAWEI-behavior-tianguan2] quit
    4. 配置流策略,将流分类和流行为进行绑定。
      [HUAWEI] traffic policy p10_up_to_down
      [HUAWEI-trafficpolicy-p10_up_to_down1] classifier tianguan1 behavior tianguan1
      [HUAWEI-trafficpolicy-p10_up_to_down1] classifier tianguan2 behavior tianguan2
      [HUAWEI-trafficpolicy-p10_up_to_down1] classifier c10_up_to_down behavior b10_up_to_down
      [HUAWEI-trafficpolicy--p10_up_to_down1] quit
    5. 在上行口vlanif10应用流策略。
      [HUAWEI] interface vlanif10
      [HUAWEI-vlanif10] traffic-policy p10_up_to_down inbound
      [HUAWEI-vlanif10] quit

  3. 配置下行口策略路由。

    1. 配置ACL规则3010。
      [HUAWEI] acl number 3010
      [HUAWEI-acl-adv-3010] rule 10 permit ip
      [HUAWEI-acl-adv-3010] quit
    2. 配置流分类c20_down_to_up。
      [HUAWE] traffic classifier c20_down_to_up
      [HUAWEI-classifier-c20_down_to_up] if-match acl 3010
      [HUAWEI-classifier-c20_down_to_up] quit
    3. 配置流行为b20_down_to_up。
      [HUAWEI] traffic behavior b20_down_to_up
      [HUAWEI-behavior-b20_down_to_up] redirect ip-nexthop 10.2.10.20  10.7.10.20
      [HUAWEI-behavior--b20_down_to_up] quit
    4. 配置流策略,将流分类和流行为进行绑定。
      [HUAWEI] traffic policy p20_down_to_up
      [HUAWEI-trafficpolicy-p20_down_to_up] classifier c20_down_to_up behavior b20_down_to_up
      [HUAWEI-trafficpolicy--p20_down_to_up] quit
    5. 将流策略应用到下行接口上。
      [HUAWEI] interface eth-trunk 1
      [HUAWEI-eth-trunk1] traffic-policy p20_down_to_up inbound
      [HUAWEI-eth-trunk1] quit

相关文档