VLAN-3.3 理解Hybrid接口的应用

实验目的:

  掌握配置Hybrid接口的方法;

  理解Hybrid接口处理Untagged数据帧的过程;

  理解Hybrid接口处理Tagged数据帧过程;

  理解Hybrid接口的应用场景;

实验拓扑:

一、基本配置:PC配置IP 地址,测试能ping通;

  使用display port vlan 查看接口的默认类型;

  使用display vlan 查看接口和所属vlan的对应关系;

二、实现组内通信,组间隔离

[S1-Ethernet0/0/1]port trunk allow-pass vlan 1
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port li    
[S1-Ethernet0/0/1]port link-t    
[S1-Ethernet0/0/1]port link-type h    
[S1-Ethernet0/0/1]port link-type hybrid 
Error: Please renew the default configurations.
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port d    
[S1-Ethernet0/0/1]port de    
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port h    
[S1-Ethernet0/0/1]port hy    
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port ?
  add-tag        Add outer tag based on acl 
  discard        Discard
  link-flap      Link flap 
  link-type      Switch port link type
  mux-vlan       Multiplex vlan
  priority       Specify current port's priority
  trunk          Trunk port
  type           Type 
  vlan-mapping   VLAN Mapping
  vlan-stacking  VLAN Stacking

[S1-Ethernet0/0/1]port li    
[S1-Ethernet0/0/1]port link-t    
[S1-Ethernet0/0/1]port link-type ?
  access        Access port
  dot1q-tunnel  QinQ port
  hybrid        Hybrid port
  trunk         Trunk port

[S1-Ethernet0/0/1]port link-type h    
[S1-Ethernet0/0/1]port link-type tr    
[S1-Ethernet0/0/1]port link-type trunk all    
[S1-Ethernet0/0/1]port link-type trunk a    
[S1-Ethernet0/0/1]port link-type trunk ?
  <cr>  

[S1-Ethernet0/0/1]port t    
[S1-Ethernet0/0/1]port trunk a    
[S1-Ethernet0/0/1]port trunk allow-pass vl    
[S1-Ethernet0/0/1]port trunk allow-pass vlan 1
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port li    
[S1-Ethernet0/0/1]port link-t    
[S1-Ethernet0/0/1]port link-type ?
  access        Access port
  dot1q-tunnel  QinQ port
  hybrid        Hybrid port
  trunk         Trunk port

[S1-Ethernet0/0/1]port link-type h    
[S1-Ethernet0/0/1]port link-type hybrid 
Error: Please renew the default configurations.
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port h    
[S1-Ethernet0/0/1]und    
[S1-Ethernet0/0/1]undo     
[S1-Ethernet0/0/1]undo po    
[S1-Ethernet0/0/1]undo portde    
[S1-Ethernet0/0/1]undo port d    
[S1-Ethernet0/0/1]undo port de    
[S1-Ethernet0/0/1]undo port default vla    
[S1-Ethernet0/0/1]undo port default vlan 1
                            ^
Error: Unrecognized command found at '^' position.
[S1-Ethernet0/0/1]und    
[S1-Ethernet0/0/1]undo po    
[S1-Ethernet0/0/1]undo port ?
  add-tag        Add outer tag based on acl 
  discard        Discard
  link-flap      Link flap 
  link-type      Switch port link type
  mux-vlan       Multiplex vlan
  priority       Specify current port's priority
  trunk          Trunk port
  type           Type 
  vlan-mapping   VLAN Mapping
  vlan-stacking  VLAN Stacking

[S1-Ethernet0/0/1]undo port t    
[S1-Ethernet0/0/1]undo port trunk ?
  allow-pass  Allowed vlan
  pvid        Specify current port's PVID VLAN characteristics

[S1-Ethernet0/0/1]undo port ?
  add-tag        Add outer tag based on acl 
  discard        Discard
  link-flap      Link flap 
  link-type      Switch port link type
  mux-vlan       Multiplex vlan
  priority       Specify current port's priority
  trunk          Trunk port
  type           Type 
  vlan-mapping   VLAN Mapping
  vlan-stacking  VLAN Stacking

[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port ?
  add-tag        Add outer tag based on acl 
  discard        Discard
  link-flap      Link flap 
  link-type      Switch port link type
  mux-vlan       Multiplex vlan
  priority       Specify current port's priority
  trunk          Trunk port
  type           Type 
  vlan-mapping   VLAN Mapping
  vlan-stacking  VLAN Stacking

[S1-Ethernet0/0/1]port li    
[S1-Ethernet0/0/1]port link-t    
[S1-Ethernet0/0/1]port link-type ?
  access        Access port
  dot1q-tunnel  QinQ port
  hybrid        Hybrid port
  trunk         Trunk port

[S1-Ethernet0/0/1]port link-type h    
[S1-Ethernet0/0/1]port link-type hybrid ?
  <cr>  

[S1-Ethernet0/0/1]port link-type hybrid vla    
[S1-Ethernet0/0/1]port link-type hybrid vlan 10 20
                                        ^
Error:Too many parameters found at '^' position.
[S1-Ethernet0/0/1]port link-type hybrid
Error: Please renew the default configurations.
[S1-Ethernet0/0/1]und    
[S1-Ethernet0/0/1]undo po    
[S1-Ethernet0/0/1]undo port lin    
[S1-Ethernet0/0/1]undo port link-t    
[S1-Ethernet0/0/1]undo port link-type tr    
[S1-Ethernet0/0/1]undo port link-type trunk
                                      ^
Error:Too many parameters found at '^' position.
[S1-Ethernet0/0/1]und    
[S1-Ethernet0/0/1]undo po    
[S1-Ethernet0/0/1]undo port ?
  add-tag        Add outer tag based on acl 
  discard        Discard
  link-flap      Link flap 
  link-type      Switch port link type
  mux-vlan       Multiplex vlan
  priority       Specify current port's priority
  trunk          Trunk port
  type           Type 
  vlan-mapping   VLAN Mapping
  vlan-stacking  VLAN Stacking

[S1-Ethernet0/0/1]undo port t    
[S1-Ethernet0/0/1]undo port trunk a    
[S1-Ethernet0/0/1]undo port trunk allow-pass vla    
[S1-Ethernet0/0/1]undo port trunk allow-pass vlan a    
[S1-Ethernet0/0/1]undo port trunk allow-pass vlan all 
[S1-Ethernet0/0/1]por    
[S1-Ethernet0/0/1]port li    
[S1-Ethernet0/0/1]port link-t    
[S1-Ethernet0/0/1]port link-type h    
[S1-Ethernet0/0/1]port link-type hybrid 
Error: Please renew the default configurations.
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port tr    
[S1-Ethernet0/0/1]port trunk a    
[S1-Ethernet0/0/1]port trunk allow-pass vla    
[S1-Ethernet0/0/1]port trunk allow-pass vlan 1
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port li    
[S1-Ethernet0/0/1]port link-t    
[S1-Ethernet0/0/1]port link-type h    
[S1-Ethernet0/0/1]port link-type hybrid 
[S1-Ethernet0/0/1]pot    
[S1-Ethernet0/0/1]por    
[S1-Ethernet0/0/1]port h    
[S1-Ethernet0/0/1]port hybrid ta    
[S1-Ethernet0/0/1]port hybrid tagged vlan    
[S1-Ethernet0/0/1]port hybrid tagged vlan 10 20
[S1-Ethernet0/0/1]quit
[S1]dis    
[S1]display vla    
[S1]display vlan 
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(U)     Eth0/0/4(U)     
                Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)     
                Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)    
                Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)    
                Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)    
                Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      

10   common  UT:Eth0/0/3(U)                                                     
             TG:Eth0/0/1(U)                                                     

20   common  UT:Eth0/0/2(U)                                                     

             TG:Eth0/0/1(U)                                                     


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020                         
[S1]
The device is running!

<Huawei>
Nov  5 2018 10:20:54-08:00 Huawei %%01PHY/1/PHY(l)[0]:    Ethernet0/0/2: change 
status to down
Nov  5 2018 10:20:55-08:00 Huawei %%01PHY/1/PHY(l)[1]:    Ethernet0/0/2: change 
status to up
Nov  5 2018 10:22:45-08:00 Huawei %%01PHY/1/PHY(l)[2]:    Ethernet0/0/2: change 
status to down
Nov  5 2018 10:22:46-08:00 Huawei %%01PHY/1/PHY(l)[3]:    Ethernet0/0/2: change 
status to up User interface con0 is available



Please Press ENTER.

<Huawei>sys    
<Huawei>system-view 
Enter system view, return user view with Ctrl+Z.
[Huawei]sy    
[Huawei]sysname S2
[S2]
Nov  5 2018 10:35:24-08:00 S2 DS/4/DATASYNC_CFGCHANGE:OID 1.3.6.1.4.1.2011.5.25.
191.3.1 configurations have been changed. The current change number is 4, the ch
ange loop count is 0, and the maximum number of records is 4095.
[S2]
[S2]
[S2]UND    
[S2]undo 
Nov  5 2018 10:35:28-08:00 S2 %%01PHY/1/PHY(l)[0]:    Ethernet0/0/2: change stat
us to down
Nov  5 2018 10:35:29-08:00 S2 %%01PHY/1/PHY(l)[1]:    Ethernet0/0/2: change stat
us to up 
         ^
Error:Incomplete command found at '^' position.
[S2]un    
[S2]undo in    
[S2]undo info-center en    
[S2]undo info-center enable 
Info: Information center is disabled.
[S2]
[S2]
[S2]vlan 10
[S2-vlan10]vlan 20
[S2-vlan20]int e0/0/3
[S2-Ethernet0/0/3]pot    
[S2-Ethernet0/0/3]por    
[S2-Ethernet0/0/3]port li    
[S2-Ethernet0/0/3]port link-t    
[S2-Ethernet0/0/3]port link-type a    
[S2-Ethernet0/0/3]port link-type access 
[S2-Ethernet0/0/3]po    
[S2-Ethernet0/0/3]port de    
[S2-Ethernet0/0/3]port default vla    
[S2-Ethernet0/0/3]port default vlan 10
[S2-Ethernet0/0/3]int e0/0/2
[S2-Ethernet0/0/2]por    
[S2-Ethernet0/0/2]port li    
[S2-Ethernet0/0/2]port link-t    
[S2-Ethernet0/0/2]port link-type a    
[S2-Ethernet0/0/2]port link-type access 
[S2-Ethernet0/0/2]po    
[S2-Ethernet0/0/2]port de    
[S2-Ethernet0/0/2]port default vl    
[S2-Ethernet0/0/2]port default vlan 20
[S2-Ethernet0/0/2]int e0/0/1
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]port li    
[S2-Ethernet0/0/1]port link-t    
[S2-Ethernet0/0/1]port link-type tr    
[S2-Ethernet0/0/1]port link-type trunk 
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]port tr    
[S2-Ethernet0/0/1]port trunk a    
[S2-Ethernet0/0/1]port trunk allow-pass vla    
[S2-Ethernet0/0/1]port trunk allow-pass vlan al    
[S2-Ethernet0/0/1]port trunk allow-pass vlan all 
[S2-Ethernet0/0/1]quit
[S2]dis    
[S2]display vlan    
[S2]display vlan 
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/1(U)     Eth0/0/4(D)     Eth0/0/5(D)     Eth0/0/6(D)     
                Eth0/0/7(D)     Eth0/0/8(D)     Eth0/0/9(D)     Eth0/0/10(D)    
                Eth0/0/11(D)    Eth0/0/12(D)    Eth0/0/13(D)    Eth0/0/14(D)    
                Eth0/0/15(D)    Eth0/0/16(D)    Eth0/0/17(D)    Eth0/0/18(D)    
                Eth0/0/19(D)    Eth0/0/20(D)    Eth0/0/21(D)    Eth0/0/22(D)    
                GE0/0/1(D)      GE0/0/2(D)                                      

10   common  UT:Eth0/0/3(U)                                                     
             TG:Eth0/0/1(U)                                                     

20   common  UT:Eth0/0/2(U)                                                     

             TG:Eth0/0/1(U)                                                     


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020                         
[S2] User interface con0 is available



Please Press ENTER.

<S2>
<S2>
<S2>y    
<S2>sy    
<S2>system-view 
Enter system view, return user view with Ctrl+Z.
[S2]und    
[S2]int e0/0/2
[S2-Ethernet0/0/2]und    
[S2-Ethernet0/0/2]undo po    
[S2-Ethernet0/0/2]undo port de    
[S2-Ethernet0/0/2]undo port default val    
[S2-Ethernet0/0/2]undo port default vl    
[S2-Ethernet0/0/2]undo port default vlan 
[S2-Ethernet0/0/2]po    
[S2-Ethernet0/0/2]port li    
[S2-Ethernet0/0/2]port link-t    
[S2-Ethernet0/0/2]port link-type h    
[S2-Ethernet0/0/2]port link-type hybrid 
[S2-Ethernet0/0/2]po    
[S2-Ethernet0/0/2]port h    
[S2-Ethernet0/0/2]port hybrid ut    
[S2-Ethernet0/0/2]port hybrid un    
[S2-Ethernet0/0/2]port hybrid untagged vl    
[S2-Ethernet0/0/2]port hybrid untagged vlan 20
[S2-Ethernet0/0/2]po    
[S2-Ethernet0/0/2]port h    
[S2-Ethernet0/0/2]port hybrid p    
[S2-Ethernet0/0/2]port hybrid pvid vl    
[S2-Ethernet0/0/2]port hybrid pvid vlan 20
[S2-Ethernet0/0/2]int e0/0/3
[S2-Ethernet0/0/3]und    
[S2-Ethernet0/0/3]undo po    
[S2-Ethernet0/0/3]undo port de    
[S2-Ethernet0/0/3]undo port default vla    
[S2-Ethernet0/0/3]undo port default vlan 
[S2-Ethernet0/0/3]po    
[S2-Ethernet0/0/3]port li    
[S2-Ethernet0/0/3]port link-t    
[S2-Ethernet0/0/3]port link-type h    
[S2-Ethernet0/0/3]port link-type hybrid 
[S2-Ethernet0/0/3]po    
[S2-Ethernet0/0/3]port h    
[S2-Ethernet0/0/3]port hybrid un    
[S2-Ethernet0/0/3]port hybrid untagged vla    
[S2-Ethernet0/0/3]port hybrid untagged vlan 10
[S2-Ethernet0/0/3]po    
[S2-Ethernet0/0/3]port h    
[S2-Ethernet0/0/3]port hybrid p    
[S2-Ethernet0/0/3]port hybrid pvid vl    
[S2-Ethernet0/0/3]port hybrid pvid vlan 10
[S2-Ethernet0/0/3]int e0/0/1
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]porttr    
[S2-Ethernet0/0/1]por    
[S2-Ethernet0/0/1]port t    
[S2-Ethernet0/0/1]port trunk a    
[S2-Ethernet0/0/1]port trunk allow-pass va    
[S2-Ethernet0/0/1]port trunk allow-pass vl    
[S2-Ethernet0/0/1]port trunk allow-pass vlan 1
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]port li    
[S2-Ethernet0/0/1]port link-t    
[S2-Ethernet0/0/1]port link-type h    
[S2-Ethernet0/0/1]port link-type hybrid 
Error: Please renew the default configurations.
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]port h    
[S2-Ethernet0/0/1]port hy    
[S2-Ethernet0/0/1]por    
[S2-Ethernet0/0/1]un    
[S2-Ethernet0/0/1]undo po    
[S2-Ethernet0/0/1]undo port t    
[S2-Ethernet0/0/1]undo port trunk a    
[S2-Ethernet0/0/1]undo port trunk allow-pass vla    
[S2-Ethernet0/0/1]undo port trunk allow-pass vlan a    
[S2-Ethernet0/0/1]undo port trunk allow-pass vlan all 
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]port tr    
[S2-Ethernet0/0/1]port trunk a    
[S2-Ethernet0/0/1]port trunk allow-pass va    
[S2-Ethernet0/0/1]port trunk allow-pass vl    
[S2-Ethernet0/0/1]port trunk allow-pass vlan 1
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]portli    
[S2-Ethernet0/0/1]port l    
[S2-Ethernet0/0/1]port link-t    
[S2-Ethernet0/0/1]port link-type h    
[S2-Ethernet0/0/1]port link-type hybrid 
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]port h    
[S2-Ethernet0/0/1]port hybrid ta    
[S2-Ethernet0/0/1]port hybrid tagged vl    
[S2-Ethernet0/0/1]port hybrid tagged vlan 10 20
[S2-Ethernet0/0/1]quit
[S2]dis    
[S2]display vla    
[S2]display vlan 
The total number of vlans is : 3
--------------------------------------------------------------------------------
U: Up;         D: Down;         TG: Tagged;         UT: Untagged;
MP: Vlan-mapping;               ST: Vlan-stacking;
#: ProtocolTransparent-vlan;    *: Management-vlan;
--------------------------------------------------------------------------------

VID  Type    Ports                                                          
--------------------------------------------------------------------------------
1    common  UT:Eth0/0/1(U)     Eth0/0/2(U)     Eth0/0/3(U)     Eth0/0/4(D)     
                Eth0/0/5(D)     Eth0/0/6(D)     Eth0/0/7(D)     Eth0/0/8(D)     
                Eth0/0/9(D)     Eth0/0/10(D)    Eth0/0/11(D)    Eth0/0/12(D)    
                Eth0/0/13(D)    Eth0/0/14(D)    Eth0/0/15(D)    Eth0/0/16(D)    
                Eth0/0/17(D)    Eth0/0/18(D)    Eth0/0/19(D)    Eth0/0/20(D)    
                Eth0/0/21(D)    Eth0/0/22(D)    GE0/0/1(D)      GE0/0/2(D)      

10   common  UT:Eth0/0/3(U)                                                     
             TG:Eth0/0/1(U)                                                     

20   common  UT:Eth0/0/2(U)                                                     

             TG:Eth0/0/1(U)                                                     


VID  Status  Property      MAC-LRN Statistics Description      
--------------------------------------------------------------------------------

1    enable  default       enable  disable    VLAN 0001                         
10   enable  default       enable  disable    VLAN 0010                         
20   enable  default       enable  disable    VLAN 0020                         
[S2]

三、实现网管员对所有网络的访问

[S1]vlan 30
[S1-vlan30]int e0/0/4
[S1-Ethernet0/0/4]por    
[S1-Ethernet0/0/4]port h    
[S1-Ethernet0/0/4]port hybrid p    
[S1-Ethernet0/0/4]port hybrid pvid vl    
[S1-Ethernet0/0/4]port hybrid pvid vlan 30
[S1-Ethernet0/0/4]por    
[S1-Ethernet0/0/4]port h    
[S1-Ethernet0/0/4]port hybrid un    
[S1-Ethernet0/0/4]port hybrid untagged vla    
[S1-Ethernet0/0/4]port hybrid untagged vlan 10 20 30
[S1-Ethernet0/0/4]int e0/0/2
[S1-Ethernet0/0/2]po    
[S1-Ethernet0/0/2]port h    
[S1-Ethernet0/0/2]port hybrid un    
[S1-Ethernet0/0/2]port hybrid untagged vla    
[S1-Ethernet0/0/2]port hybrid untagged vlan 20 30
[S1-Ethernet0/0/2]int e0/0/3
[S1-Ethernet0/0/3]po    
[S1-Ethernet0/0/3]port h    
[S1-Ethernet0/0/3]port hybrid un    
[S1-Ethernet0/0/3]port hybrid untagged vla    
[S1-Ethernet0/0/3]port hybrid untagged vlan 10 30
[S1-Ethernet0/0/3]int e0/0/1
[S1-Ethernet0/0/1]po    
[S1-Ethernet0/0/1]port h    
[S1-Ethernet0/0/1]port hybrid un    
[S1-Ethernet0/0/1]port hybrid untagged  vl    
[S1-Ethernet0/0/1]port hybrid untagged  vlan 10 20 30
[S1-Ethernet0/0/1]
[S2]por    
[S2]int e0/0/2
[S2-Ethernet0/0/2]por    
[S2-Ethernet0/0/2]port h    
[S2-Ethernet0/0/2]port hybrid u    
[S2-Ethernet0/0/2]port hybrid untagged vla    
[S2-Ethernet0/0/2]port hybrid untagged vlan 20 30
[S2-Ethernet0/0/2]int e0/0/3
[S2-Ethernet0/0/3]po    
[S2-Ethernet0/0/3]port h    
[S2-Ethernet0/0/3]port hybrid un    
[S2-Ethernet0/0/3]port hybrid untagged vl    
[S2-Ethernet0/0/3]port hybrid untagged vlan 10 30
[S2-Ethernet0/0/3]int e0/0/1
[S2-Ethernet0/0/1]po    
[S2-Ethernet0/0/1]port h    
[S2-Ethernet0/0/1]port hybrid ta    
[S2-Ethernet0/0/1]port hybrid tagged vl    
[S2-Ethernet0/0/1]port hybrid tagged vlan 10 20 30
[S2-Ethernet0/0/1]

测试pc5可以ping通其他的pc:

原文地址:https://www.cnblogs.com/1218-mzc/p/9897540.html