接上回ide
实验二: 理解trunk接口对数据帧收发处理过程的处理测试
业务规划以下:ui
(注:为保证明验效果,请暂时关闭两台交换机的CDP和STP) spa
SW2(config)#no cdp run blog
SW2(config)#no spanning-tree vlan 1-4094 接口
在SW1上建立 vlan 10,并将e0/0接口划分入 vlan 10 ip
SW1(config)#vlan 10
SW1(config-vlan)#interface e0/0
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10get
在SW2上建立 vlan 20,并将e0/0接口划分入 vlan 20 it
SW2(config)#vlan 20
SW2(config-vlan)#interface e0/0
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 20io
将SW1的e1/0接口配置为turnk并修改PVID为 10
SW1(config)#interface e1/0
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk native vlan 10
将SW2的e1/0接口配置为turnk并修改PVID为 20
SW2(config)#interface e1/0
SW2(config-if)#switchport trunk encapsulation dot1q
SW2(config-if)#switchport mode trunk
SW2(config-if)#switchport trunk native vlan 20
在R1和R2上配置IP地址,并作连通性测试:
R1#ping 12.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/1/1 ms
经过在SW1和SW2之间的接口上抓取报文观察,报文确实没有携带802.1Q标记
实验三: 了解全局配置模式下的命令 vlan dot1q tag native 的做用
在上述实验环境中的两台交换机上配置这条命令
SW1(config)# vlan dot1q tag native
再次作连通性测试:
R1#ping 12.1.1.2
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 12.1.1.2, timeout is 2 seconds:
.....
Success rate is 0 percent (0/5)
如下展现思科对这条命令的解释
Usage Guidelines
Typically, you configure 802.1Q trunks with a native VLAN ID, which strips tagging from all packets on that VLAN.
To maintain the tagging on the native VLAN and drop untagged traffic, use the vlan dot1q tag native command. The switch will tag the traffic received on the native VLAN and admit only 802.1Q-tagged frames, dropping any untagged traffic, including untagged traffic in the native VLAN.
Control traffic continues to be accepted as untagged on the native VLAN on a trunked port, even when the vlan dot1q tag native command is enabled.
注意我标注的句子,这意味着一旦使用了这条命令,将会影响交换机trunk接口对数据帧的处理规则。
稍微解释一下就是:
发送数据帧的时候交换机将会为来自全部native VLAN的数据帧打上标记;
仅仅接收携带802.1Q标记的数据帧,丢弃全部不携带标记的数据帧,即便该数据帧是来自native VLAN的;
谢谢你们!我是达叔。