作者:张雍昊 | 来源:互联网 | 2023-10-10 17:36
336、实验vlan mapping:
vlan mapping工作原理:当数据包经过vlan标签转换口的时候,转换口直接将vlan的标签转换成为了上层vlan的标签,下联的所有接口都属于上联vlan;
实验需求:
使VLAN 30、31、32的数据包经过上联口之后,转换成为VLAN 100 ,打上VLAN 100 的tag;
实验topo:
实验步骤:
#
interface GigabitEthernet0/0/3
qinq vlan-translation enable
port link-type trunk
port trunk allow-pass vlan 2 to 4094
port vlan-mapping vlan 30 to 39 map-vlan 100
#
①将SW1的三个接口均划分为trunk口:
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
②分别将两个交换机分别打trunk、其他的接口分别划分至vlan 30 ,vlan 31 ,vlan 32中;
SW2 :
#
interface GigabitEthernet0/0/1
port link-type access
port default vlan 30
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 31
#
interface GigabitEthernet0/0/3
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
SW3:
#
interface GigabitEthernet0/0/1
port link-type trunk
port trunk allow-pass vlan 2 to 4094
#
interface GigabitEthernet0/0/2
port link-type access
port default vlan 32
#
④将局域网的上联出口开启vlan标签转换,并设置标签转换:
#
interface GigabitEthernet0/0/3
qinq vlan-translation enable 开启vlan标签转换
port vlan-mapping vlan 30 to 39 map-vlan 100 将vlan 30-39 的标签转换为vlan 100的标签;
#
查看vlan:
由于实验环境限制(模拟器bug)不能真正的实现vlan标签的转换;
tips: qinq ,指的是标签转换为标签;
trunk的封装:802.1q协议;