HUAWEI-vlan\trunk\hybrid


HUAWEI-vlan\trunk\hybrid

 相同的原理就不再多說,只介紹配置命令以及和cisco不同之處,由於HUAWEI部份純自學,供自己復習使用,如果你有幸看到錯誤,請及時評論,謝謝

 


HUAWEI-vlan

 

 

 

 配置華為交換機vlan,使現在的同網段不同VLAN不可通信

 

[sw1]vlan batch 10 20    //同時創建多個VLAN,使用關鍵字batch
[sw1]inter e0/0/1
[sw1-Ethernet0/0/1]port link-type access    // 接口類型改為access
[sw1-Ethernet0/0/1]port default vlan 10  //將接口划入vlan10中
[sw1-Ethernet0/0/1]inter e0/0/2
[sw1-Ethernet0/0/1]port link-type access
[sw1-Ethernet0/0/1]port default vlan 20

查看VLAN

  

PC方面就不用測試了,肯定是不通的,

 

如果此時有多個接口同屬於一個vlan呢?如何操作?

cisco里的inter range ?

HUAWEI里叫Port-group

[sw1]port-group 1   //創建組1
[sw1-port-group-1]group Ethernet 0/0/3 to e0/0/10  //組內接口有0/0/3到0/0/10
[sw1-port-group-1]port link-type access
[sw1-port-group-1]port defa vlan 10

 


TRUNK

實現跨交換機的同VLAN通信,可以攜帶VLAN標簽,

ACCESS接口不能攜帶標簽,

 

 

 

 唯一和cisco不同的是,也是需要注意的,

就是huaweitrunk接口要手動允許VLAN的通過,

CISCO默認就支持所有VLAN通過,

 

具體配置如下,SW1e0/0/1口,和SW2e0/0/3

[sw1]inter e0/0/3
[sw1-Ethernet0/0/3]port link-type trunk  \\接口模式改為trunk
[sw1-Ethernet0/0/3]port trunk allow-pass vlan all  //配置允許所有VLAN通過,實際要看需求
[sw1-Ethernet0/0/3]dis this  //查看這個接口的配置,(HUAWEI特有命令,很好用)
interface Ethernet0/0/3
 port link-type trunk
 port trunk allow-pass vlan 2 to 4094

 
[SW2-Ethernet0/0/3]inter e0/0/1
[SW2-Ethernet0/0/1]port link trunk
[SW2-Ethernet0/0/1]port trunk all vlan all

 

同樣在SW2上也要配置VLAN,然后將接口划分到相應的VLAN中,這里就不再贅述了

 

 

 相同VLAN可以通信,不同VLAN不可以通信,

當然,不同網關如果想要通信的話,就要借助三層路由設備。

 


HYBRID接口

HUAWEI交換機的一個特殊接口,

這個東西要怎么理解呢?其實很簡單,你可以理解為access+trunk的一個混雜端口

它即可以拆除tag,也可以攜帶tag,

也就是說,它可以充當access接口,又可以充當trunk接口

 

 

 有圖有真像,

左側SW1上的所有接口設置為hybrid,右側不變,trunk+access

實現相同VLAN跨交換機通信

將左側相應接口恢復默認

[sw1]clear configuration inter e0/0/1   //清除e0/0/1接口上的配置

[sw1]clear configuration inter e0/0/2

[sw1]clear configuration inter e0/0/3

清除完以后,要手動的開啟接口,undo shutdown 

[sw1]inter e0/0/1
[sw1-Ethernet0/0/1]port link-type hybrid   //華為交換機接口默認就是hybrid模式
[sw1-Ethernet0/0/1]port hybrid pvid vlan 10  //屬於VLAN10
[sw1-Ethernet0/0/1]port hybrid untagged vlan 10  //針對於外邊來的數據要解封裝VLAN10
[sw1-Ethernet0/0/1]inter e0/0/2
[sw1-Ethernet0/0/2]port link-type hy
[sw1-Ethernet0/0/2]port hybrid pvid vlan 20
[sw1-Ethernet0/0/2]port hybrid untagged vlan 20
[sw1-Ethernet0/0/2]inter e0/0/3
[sw1-Ethernet0/0/3]port link-type hybrid  
[sw1-Ethernet0/0/3]port hybrid tagged vlan 10 20 ?  //出去要攜帶vlan的標簽,包括10,20
  INTEGER<1-4094>  VLAN ID
  to               Range link symbol  //to關鍵字,帶表可以配置多個VLAN
  <cr>             
 
[sw1-Ethernet0/0/3]port hybrid tagged vlan 10 20
[sw1-Ethernet0/0/3]

經過 測試也是沒問題的

 

 

 


HYBRID接口深度理解

 

 

 單交換機環境中下,使用HYBRID接口實現互通~

需求,vlan5---vlan6不通,但是都可以和vlan7 通,全同網段

 

分析,hybrid接口可以實現untag,那么就是如何實現解tag了,具體解哪個tag呢?

假設,vlan5通過e0/0/1口發到交換機,傳給vlan7,hybrid接口默認攜帶標簽,那么就要讓它解掉標簽然后傳到PC7

VLAN6針對於VLAN5的標簽肯定是不收的

 

先看一下默認的配置

[sw]inter e0/0/1
[sw-Ethernet0/0/1]port link-type h
[sw-Ethernet0/0/1]port hybrid pvid vlan 5  
[sw-Ethernet0/0/1]port hybrid untagged vlan 5
[sw-Ethernet0/0/1]inter e0/0/2
[sw-Ethernet0/0/2]port link-type h
[sw-Ethernet0/0/2]port hybrid pvid vlan 6 
[sw-Ethernet0/0/2]port hy un vlan 6
[sw-Ethernet0/0/2]inter e0/0/3
[sw-Ethernet0/0/3]port link-type h
[sw-Ethernet0/0/3]port hy pvid vlan 7
[sw-Ethernet0/0/3]port hybrid untagged vlan 7

 

 划分基本VLAN,接口修改模式,

現在實現需求,

分析1 vlan5--7  vlan6--7是可以通信的,

那可不可以這樣,將e0/0/1口和e0/0/3口上untaged vlan7

再到e0/0/3上去untag 5 6 vlan 標簽

 

[sw-Ethernet0/0/3]
[sw-Ethernet0/0/3]port hybrid un vlan 5 6   //的VLAN7的接口解封裝VLAN5 6 的
[sw-Ethernet0/0/3]inter e0/0/2
[sw-Ethernet0/0/2]port hy untag vlan 7  VLAN6這邊,針對於vlan7的tag進行拆除
[sw-Ethernet0/0/3]inter e0/0/3
[sw-Ethernet0/0/2]port hy untag vlan 7

VLANt7和其它兩個VLAN 內主機,可以通信

VLAN5VLAN6之間就是不可能通信的

 

 

 當然話不能說的太死,容易打臉,因為后面還有單臂 路由和三層交換機呢~

 

敬請期待

 

 

--------------------------------------

CCIE成長之路 --- 梅利


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM