https://learningnetwork.cisco.com/s/question/0D53i00000Kt7P2/encapsulation-dot1q-vlan-id
有时候我们会看到一些路由器的子接口下面配置了encapsulation dot1q vlan-id, 比如:
Router#sh run int GigabitEthernet0/1.633
Building configuration...
Current configuration : 209 bytes
!
interface GigabitEthernet0/1.633
bandwidth 2048
encapsulation dot1Q 633
ip address X.X.X.X X.X.X.X
no ip redirects
no ip unreachables
no ip proxy-arp
no cdp enable
crypto map XYZ
end
这里的网络拓扑是客户的CGW设备直连到ISP的设备上,然后客户在自己的CGW的子接口封装了vlan id,也就是会给从这个子接口发出去的所有帧打上633的标签并且这个接口也只会接收有633标签的帧,其他的帧会被丢弃。这就保证了ISP设备可以区分不同的客户的帧。
I’m assuming that this router’s GigabitEthernet0/1 port is connected either directly to the SP’s router or (more likely) to a intermediary switch which sits between your device and the SP’s router, right? Your router will simply tag any frame coming off that sub-interface on the way to the SP’s router, using 633, and it will expect all incoming frames to be tagged likewise. Your router doesn’t require any VLAN configuration to do this.
The service provider end device is probably a switch and within that switch the service provider segments customers based on VLAN. So the SP device would have one or more VLANs including 633. Since your router has a sub-interface tagged with 633 that means that the service provider’s port is configured as a trunk and the native VLAN of that trunk is other than 633 or they’ve configured even the native vlan to be tagged. Either way, your router can tag frames without any local VLANs.
补充知识:
- 默认native vlan是vlan1, 可以手动改, 本征vlan在发送帧的时候不会加tag,会提高效率。trunk链路也就是中继链路中才会native vlan的概念, access链路没有本征vlan一说
https://baike.baidu.com/item/%E6%9C%AC%E5%BE%81vlan