1.实验环境: 某运营商接了公司A和公司B的网络,现需要使用qinq技术实现公司A、公司B的私有网络能够使用运营商网络互通。公司A使用灵活的qinq让内部网络的vlan 10映射为公网vlan2进行数据转发,vlan20映射为vlan3进行数据转发。公司B使用基本的qinq让内部网络所有vlan 映射为公网vlan 4进行数据转发。
2.实验目的:
掌握灵活qinq和基本qinq的配置
3.实验拓扑:
配置QINQ实验拓扑如图所示。
配置QINQ
4.实验步骤
1)配置公司A和公司B的私有网络,创建对应的vlan,并且接口的链路类型
S3的配置:
<Huawei>system-view
[huawei]sysname s3
[s3]vlan batch 10 20
[s3]interface g0/0/2
[s3-GigabitEthernet0/0/2]port link-type access
[s3-GigabitEthernet0/0/2]port default vlan 10
[s3]interface g0/0/3
[s3-GigabitEthernet0/0/3]port link-type access
[s3-GigabitEthernet0/0/3]port default vlan 20
[s3]interface g0/0/1
[s3-GigabitEthernet0/0/1]port link-type trunk
[s3-GigabitEthernet0/0/1]port trunk allow-pass vlan 10 20
S4的配置:
<Huawei>system-view
[Huawei]sysname s4
[s4]vlan batch 10 20
[s4]interface GigabitEthernet0/0/1
[s4-GigabitEthernet0/0/1] port link-type trunk
[s4-GigabitEthernet0/0/1] port trunk allow-pass vlan 10 20
[s4-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2
[s4-GigabitEthernet0/0/2] port link-type access
[s4-GigabitEthernet0/0/2] port default vlan 10
[s4-GigabitEthernet0/0/2]interface GigabitEthernet0/0/3
[s4-GigabitEthernet0/0/3] port link-type access
[s4-GigabitEthernet0/0/3] port default vlan 20
S5的配置:
<Huawei>system-view
Enter system view, return user view with Ctrl+Z.
[Huawei]sysname s5
[s5]vlan 10
[s5]interface g0/0/2
[s5-GigabitEthernet0/0/2]port link-type access
[s5-GigabitEthernet0/0/2]port default vlan 10
[s5]interface g0/0/1
[s5-GigabitEthernet0/0/1]port link-type trunk
[s5-GigabitEthernet0/0/1]port trunk allow-pass vlan 10
S6:
[s6]interface GigabitEthernet0/0/1
[s6-GigabitEthernet0/0/1] port link-type trunk
[s6-GigabitEthernet0/0/1] port trunk allow-pass vlan 10
[s6-GigabitEthernet0/0/1]interface GigabitEthernet0/0/2
[s6-GigabitEthernet0/0/2] port link-type access
[s6-GigabitEthernet0/0/2] port default vlan 10
2)在公网设备配置公网vlan,并且配置qinq
S1的配置:
<Huawei>system-view
[Huawei]sysname S1
[S1]vlan batch 2 3 4
[S1]interface g0/0/1
[S1-GigabitEthernet0/0/1]port link-type hybrid
[S1-GigabitEthernet0/0/1]port hybrid untagged vlan 2 3
[S1-GigabitEthernet0/0/1]qinq vlan-translation enable
[S1-GigabitEthernet0/0/1]port vlan-stacking vlan 10 stack-vlan 2
[S1-GigabitEthernet0/0/1]port vlan-stacking vlan 20 stack-vlan 3
[S1]interface g0/0/3
[S1-GigabitEthernet0/0/3]port link-type dot1q-tunnel
[S1-GigabitEthernet0/0/3]port default vlan 4
S2的配置:
[s2]interface g0/0/2
[s2-GigabitEthernet0/0/2]port link-type hybrid
[s2-GigabitEthernet0/0/2]port hybrid untagged vlan 2 3
[s2-GigabitEthernet0/0/2]qinq vlan-translation enable
[s2-GigabitEthernet0/0/2]port vlan-stacking vlan 10 stack-vlan 2
[s2-GigabitEthernet0/0/2]port vlan-stacking vlan 20 stack-vlan 3
[s2]interface g0/0/3
[s2-GigabitEthernet0/0/3]port link-type dot1q-tunnel
[s2-GigabitEthernet0/0/3]port default vlan 4
3)配置公网设备互联端口的链路类型,放行公网vlan流量通过
S1的配置:
[S1]interface g0/0/2
[S1-GigabitEthernet0/0/2]port link-type trunk
[S1-GigabitEthernet0/0/2]port trunk allow-pass vlan 2 3 4
S2:
[s2]interface g0/0/1
[s2-GigabitEthernet0/0/1]port link-type trunk
[s2-GigabitEthernet0/0/1]port trunk allow-pass vlan 2 3 4
测试PC1和PC2 、PC5和PC6、PC3和PC4的连通性,并且在S1的G0/0/2口抓包
PC1pingPC2
PC>ping 10.1.1.2
Ping 10.1.1.2: 32 data bytes, Press Ctrl_C to break
From 10.1.1.2: bytes=32 seq=1 ttl=128 time=125 ms
From 10.1.1.2: bytes=32 seq=2 ttl=128 time=156 ms
From 10.1.1.2: bytes=32 seq=3 ttl=128 time=109 ms
From 10.1.1.2: bytes=32 seq=4 ttl=128 time=141 ms
From 10.1.1.2: bytes=32 seq=5 ttl=128 time=125 ms
--- 10.1.1.2 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 109/131/156 ms
如图,可以看到外层标签为2(公网vlan的标签)、内层标签为10(私有网络vlan的标签)
S1的G0/0/2口抓包结果(1)
PC5 ping PC6
PC5>ping 10.1.1.6
Ping 10.1.1.6: 32 data bytes, Press Ctrl_C to break
From 10.1.1.6: bytes=32 seq=1 ttl=128 time=156 ms
From 10.1.1.6: bytes=32 seq=2 ttl=128 time=125 ms
From 10.1.1.6: bytes=32 seq=3 ttl=128 time=109 ms
From 10.1.1.6: bytes=32 seq=4 ttl=128 time=110 ms
From 10.1.1.6: bytes=32 seq=5 ttl=128 time=125 ms
--- 10.1.1.6 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 109/125/156 ms
如图,可以看出外层标签为3,内层标签为20 .说明灵活qinq实现了不同的私网vlan映射到不同的公网vlan上
S1的G0/0/2口抓包结果(2)
PC3 ping PC4
PC3>ping 10.1.1.4
Ping 10.1.1.4: 32 data bytes, Press Ctrl_C to break
From 10.1.1.4: bytes=32 seq=1 ttl=128 time=125 ms
From 10.1.1.4: bytes=32 seq=2 ttl=128 time=109 ms
From 10.1.1.4: bytes=32 seq=3 ttl=128 time=140 ms
From 10.1.1.4: bytes=32 seq=4 ttl=128 time=109 ms
From 10.1.1.4: bytes=32 seq=5 ttl=128 time=110 ms
--- 10.1.1.4 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 109/118/140 ms
如图可以看出内网标签为10,外网标签为4。说明基本qinq无论内网标签是多少,映射的外网标签都是固定同一个。
S1的G0/0/2口抓包结果(3)
需要更多项目使用或数通考试题目的 ,点赞+私 ,找鹏哥领取资料!!