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不同的是,也是需要注意的,
就是huawei的trunk接口要手动允许VLAN的通过,
而CISCO默认就支持所有VLAN通过,
具体配置如下,SW1的e0/0/1口,和SW2的e0/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 内主机,可以通信
而VLAN5和VLAN6之间就是不可能通信的
当然话不能说的太死,容易打脸,因为后面还有单臂 路由和三层交换机呢~
敬请期待
--------------------------------------
CCIE成长之路 --- 梅利