天天看點

華為ensp 二層交換機使用vlan實作不同網段互通

實驗拓撲圖如下

1.隻使用Vlan的trunk接口和access接口實作兩個二層交換機上屬于不同Vlan的PC互通

備注:需要使用到port trunk pvid vlan xx 等實作該功能。
華為ensp 二層交換機使用vlan實作不同網段互通

提前配置好IP位址及端口位址

LSW10配置:

#
sysname LSW10
#
vlan batch 10 20 100
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 10
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 100
#
interface Ethernet0/0/3
 port link-type access
 port default vlan 20
#
interface Ethernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 10 20 100
#
           

LSW11配置:

#
sysname LSW11
#
vlan batch 10 20 100
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1
 port link-type access
 port default vlan 10
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 100
#
interface Ethernet0/0/3
 port link-type access
 port default vlan 20
#
interface Ethernet0/0/4
 port link-type trunk
 port trunk allow-pass vlan 10 20 100
#
           

pc17 與 pc20 互通

華為ensp 二層交換機使用vlan實作不同網段互通

 pc18 與 pc21 互通

華為ensp 二層交換機使用vlan實作不同網段互通

 pc19 與 pc22 互通

華為ensp 二層交換機使用vlan實作不同網段互通

結果:pc17 與 pc20 互通, pc18 與 pc21 互通, pc19 與 pc22 互通,其它互相ping不通。

若想讓PC17ping通pc22需在LSW10接口Ethernet0/0/4上添加port trunk pvid vlan 10,

再LSW11接口Ethernet0/0/4上添加port trunk pvid vlan 20 。

同理:PC19ping通pc20需在LSW10接口Ethernet0/0/4上添加port trunk pvid vlan 20,

再LSW11接口Ethernet0/0/4上添加port trunk pvid vlan 10 。

華為ensp 二層交換機使用vlan實作不同網段互通
本實驗應該應用兩交換機,兩個pc較為準确。

實驗二:

2. 使用hybrid的端口實作兩個二層交換機上屬于不同Vlan的PC互通

華為ensp 二層交換機使用vlan實作不同網段互通

提前配置好ip及端口位址 

LSW12配置:

#
sysname LSW12
#
vlan batch 10 20
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1    //華為交換機預設port link-tyep hybrid 
 port hybrid untagged vlan 10 20
#
interface Ethernet0/0/2
 port link-type access
 port default vlan 20
#
interface Ethernet0/0/3    //華為交換機預設port link-tyep hybrid 
 port hybrid pvid vlan 20
 port hybrid tagged vlan 10 20
#

           

LSW13配置:

#
sysname LSW13
#
vlan batch 10 20
#
interface Vlanif1
#
interface MEth0/0/1
#
interface Ethernet0/0/1     //華為交換機預設port link-tyep hybrid
 port hybrid untagged vlan 10 20  
#
interface Ethernet0/0/2
#
interface Ethernet0/0/3    //華為交換機預設port link-tyep hybrid
 port hybrid pvid vlan 20
 port hybrid tagged vlan 10 20
#
           

各pc23,pc24,pc25互ping

華為ensp 二層交換機使用vlan實作不同網段互通
華為ensp 二層交換機使用vlan實作不同網段互通
華為ensp 二層交換機使用vlan實作不同網段互通
結果: pc25可以ping通pc23,24,而pc23不能ping通pc24。