接上回

实验二:  理解trunk接口对数据帧收发处理过程的处理

业务规划如下:

image

(注:为保证实验效果,请暂时关闭两台交换机的CDP和STP)  

SW2(config)#no cdp run  

SW2(config)#no spanning-tree vlan 1-4094  


在SW1上创建 vlan 10,并将e0/0接口划分入 vlan 10  

SW1(config)#vlan 10
SW1(config-vlan)#interface e0/0
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 10


在SW2上创建 vlan 20,并将e0/0接口划分入 vlan 20  

SW2(config)#vlan 20
SW2(config-vlan)#interface e0/0
SW2(config-if)#switchport mode access
SW2(config-if)#switchport access vlan 20


将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标记

CCNP实战之802.1Q及VLAN的实现(续)_第1张图片


实验三: 了解全局配置模式下的命令 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的;  


谢谢大家!我是达叔。