802.1q tunneling又叫做QinQ,能利用隧道技术,让服务供应商(ISP)仅用一个VLAN来支持客户端的多个VLAN,从而防止多客户存在而很快消耗掉4096个VLAN上限。QinQ技术通过配置隧道端口(tunnel port),并通过对传入ISP的封包进行双TAG处理,以在ISP端传输。该技术所建立的连接被称为非对称连接,因为一端是tunnel口,另一端可能是trunk口或者路由器子接口。

  好,废话不多说,先说说今天做的实验成果。

  首先挨踢小茶GNS3搭建好拓扑,但是不能打命令,switch mode下只有access和trunk。。囧。。
  然后用IOU搭建好拓扑,发现命令都能打,但是却不能通,show cdp nei不能在Customer side互相发现,也ping不通。(如果有兴趣用IOU进行实验,可以留言找我要拓扑文件和配置文件)。后来在虚拟化先锋论坛看了一下,发现是真的不支持,真是浪费我表情……

(不知道IOU是什么?可以先看这里:IOU,IOL初探

cisco-qinq

  最后只好用真机实验,实验环境是2台3750交换机,1台3550交换机。
  其中3550交换机模拟ISP环境,2台3750交换机模拟客户端。
  客户端如果是路由器,直接用子接口来做,方法就是配成单臂路由。如果用交换机来做,就创建2个Vlan,帮SVI配置IP地址即可。
拓扑图:

qinq-switch

配置如下:

Customer1:

interface FastEthernet1/0/1
 switchport trunk encapsulation dot1q
 switchport mode trunk
interface Vlan14
 ip address 14.0.0.1 255.255.255.0
interface Vlan41
 ip address 41.0.0.1 255.255.255.0

Customer2:

interface FastEthernet1/0/17
 switchport trunk encapsulation dot1q
 switchport mode trunk
interface Vlan14
 ip address 14.0.0.2 255.255.255.0
interface Vlan41
 ip address 41.0.0.2 255.255.255.0

ISP:

system mtu 1504
interface FastEthernet0/14
 switchport access vlan 100
 switchport mode dot1q-tunnel
 l2protocol-tunnel cdp
 l2protocol-tunnel stp
 l2protocol-tunnel vtp
 no cdp enable
interface FastEthernet0/23
 switchport access vlan 100
 switchport mode dot1q-tunnel
 l2protocol-tunnel cdp
 l2protocol-tunnel stp
 l2protocol-tunnel vtp
 no cdp enable

实验结果:

Customer1#show cdp nei
Capability Codes: R – Router, T – Trans Bridge, B – Source Route Bridge
S – Switch, H – Host, I – IGMP, r – Repeater, P – Phone,
D – Remote, C – CVTA, M – Two-port Mac RelayDevice ID Local Intrfce Holdtme Capability Platform Port ID
Customer2 Fas 1/0/1 120 R S I WS-C3750- Fas 1/0/17
Customer1#ping 14.0.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 14.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/9 ms
Customer1#ping 41.0.0.2

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to 41.0.0.2, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/2/8 ms

  实验结果证明了802.1q tunneling的连通性和透明性。
  如果MTU的值使用默认的1500的话,或者刚刚配好tunnel口的话,系统会弹出信息:

System MTU of 1500 might be insufficient for 802.1Q tunnelling.
802.1Q tunnelling requires system MTU size of 1504 to handle maximum size ethernet frames.

但事实上,MTU为1500的时候,不影响客户端,其实验结果是一样的。

  最后更新GNS3无法模拟的实验文章,总体感觉还是IOU强大一点。