在网络部署与配置过程中,有时会遇到需要在交换机进行伪装的情况,但如何进行交换机VLAN的伪装?这里联华世纪将以华为交换机VLAN伪装实验为案例为大家一一演示其具体步骤。
两端客户使用不同VLAN,使用port link-type hybrid进行VLAN tagged伪装,把VLAN10伪装成VLAN20。
设备配置
PC1
A端交换机
dis cu
#
sysname Huawei
#
vlan batch 10
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 10
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
Return
传输交换机
dis cu
#
sysname Huawei
#
vlan batch 10 20 100
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 10
#
interface GigabitEthernet0/0/2
qinq vlan-translation enable
port hybrid tagged vlan 10
port vlan-mapping vlan 20 map-vlan 10
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
return
B端交换机
dis cu
#
sysname Huawei
#
vlan batch 20
#
cluster enable
ntdp enable
ndp enable
#
drop illegal-mac alarm
#
diffserv domain default
#
drop-profile default
#
aaa
authentication-scheme default
authorization-scheme default
accounting-scheme default
domain default
domain default_admin
local-user admin password simple admin
local-user admin service-type http
#
interface Vlanif1
#
interface MEth0/0/1
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 20
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 20
#
interface GigabitEthernet0/0/3
#
interface GigabitEthernet0/0/4
#
interface GigabitEthernet0/0/5
#
interface GigabitEthernet0/0/6
#
interface GigabitEthernet0/0/7
#
interface GigabitEthernet0/0/8
#
interface GigabitEthernet0/0/9
#
interface GigabitEthernet0/0/10
#
interface GigabitEthernet0/0/11
#
interface GigabitEthernet0/0/12
#
interface GigabitEthernet0/0/13
#
interface GigabitEthernet0/0/14
#
interface GigabitEthernet0/0/15
#
interface GigabitEthernet0/0/16
#
interface GigabitEthernet0/0/17
#
interface GigabitEthernet0/0/18
#
interface GigabitEthernet0/0/19
#
interface GigabitEthernet0/0/20
#
interface GigabitEthernet0/0/21
#
interface GigabitEthernet0/0/22
#
interface GigabitEthernet0/0/23
#
interface GigabitEthernet0/0/24
#
interface NULL0
#
user-interface con 0
user-interface vty 0 4
#
PC2
测试结果
可以看到VLAN10的1.1.1.1与VLAN20的1.1.1.2已经互通,说明交换机的伪装已经生效。
当你在交换机上执行以下命令时,你正在配置 QinQ(双层 VLAN)的 VLAN 翻译(VLAN Translation)功能。这些命令的作用如下:
qinq vlan-translation enable:启用 QinQ VLAN 翻译功能。这意味着交换机将会执行 QinQ 的 VLAN 标记转换。
port hybrid tagged vlan 10:配置端口(可能是某个接口)为混合模式(Hybrid Mode),并将 VLAN 10 标记为已标记的 VLAN。这意味着 VLAN 10 的帧将被发送到这个端口,并且保留其 VLAN 标记。
port vlan-mapping vlan 20 map-vlan 10:配置端口上的 VLAN 映射。这里指定将 VLAN 20 映射到 VLAN 10。这意味着当交换机收到来自 VLAN 20 的帧时,它会将这些帧的 VLAN 标记更改为 VLAN 10,并将其发送到相应的端口。
这些命令的目的是在交换机上设置 VLAN 翻译,以允许帧在不同的 VLAN 之间进行转换。请注意,具体的命令语法和配置可能会因交换机型号和固件版本而略有不同。在实际配置时,请根据您的设备和网络需求进行相应的调整,如遇到无法解决的问题或有其他云网部署及配置需求,欢迎联系联华世纪。
编辑:技术部陈经理
联系方式:infor@linkchina.com.cn