在SW1上配置命令如下
[SW1]int Eth-Trunk 1
[SW1-Eth-Trunk1]trunkport Ethernet 0/0/1 to 0/0/3
在SW2上配置命令如下
[SW2]int Eth-Trunk 1
[SW2-Eth-Trunk1]trunkport Ethernet 0/0/1 to 0/0/3
[SW1-Eth-Trunk1]dis eth-trunk 1
Eth-Trunk1's state information is:
WorkingMode: NORMAL Hash arithmetic: According to SIP-XOR-DIP
Least Active-linknumber: 1 Max Bandwidth-affected-linknumber: 8
Operate status: up Number Of Up Port In Trunk: 3
--------------------------------------------------------------------------------
PortName Status Weight
Ethernet0/0/1 Up 1
Ethernet0/0/2 Up 1
Ethernet0/0/3 Up 1
SW1 上配置
[SW1-Eth-Trunk1]port link-type hybrid
[SW1-Eth-Trunk1] port hybrid tagged vlan 10 20 30
SW2 上配置
[SW2-Eth-Trunk1]port link-type hybrid
[SW2-Eth-Trunk1] port hybrid tagged vlan 10 20 30
SW1
[SW1]int e0/0/4
[SW1-Ethernet0/0/4]port link-type hybrid
[SW1-Ethernet0/0/4]port hybrid pvid vlan 10
[SW1-Ethernet0/0/4]port hybrid tagged vlan 10
[SW1-Ethernet0/0/4]port hybrid untagged vlan 20 30
[SW1]int e0/0/5
[SW1-Ethernet0/0/5]port link-type hybrid
[SW1-Ethernet0/0/5]port hybrid pvid vlan 20
[SW1-Ethernet0/0/5]port hybrid tagged vlan 20
[SW1-Ethernet0/0/5]port hybrid untagged vlan 10 20 30
//因为拓扑图里PC5也属于VLAN 20;这里需要配置剥离 VLAN 20的标签,因为主机只能接收以太帧,如果接收到802.1Q的帧 则丢弃。
[SW1]int e0/0/6
[SW1-Ethernet0/0/6]port link-type hybrid
[SW1-Ethernet0/0/6]port hybrid pvid vlan 20
[SW1-Ethernet0/0/6]port hybrid tagged vlan 20
[SW1-Ethernet0/0/6]port hybrid untagged vlan 10 20 30
SW2
[AR2]int e0/0/5
[AR2-Ethernet0/0/5]port link-type hybrid
[AR2-Ethernet0/0/5]port hybrid pvid vlan 30
[AR2-Ethernet0/0/5]port hybrid tagged vlan 30
[AR2-Ethernet0/0/5]port hybrid untagged vlan 10 20
PC>ping 192.168.1.1
Ping 192.168.1.1: 32 data bytes, Press Ctrl_C to break
From 192.168.1.1: bytes=32 seq=1 ttl=128 time=63 ms
From 192.168.1.1: bytes=32 seq=2 ttl=128 time=78 ms
From 192.168.1.1: bytes=32 seq=3 ttl=128 time=62 ms
From 192.168.1.1: bytes=32 seq=4 ttl=128 time=63 ms
From 192.168.1.1: bytes=32 seq=5 ttl=128 time=62 ms
--- 192.168.1.1 ping statistics ---
5 packet(s) transmitted
5 packet(s) received
0.00% packet loss
round-trip min/avg/max = 62/65/78 ms
重新PING 一次,我们在 SW1 e0/0/2网段开始抓包,查看抓取的 Ping 包内容
request 请求的数据包,源地址 192.168.1.2 去往 192.168.1.1 是802.1Q的帧,VLAN ID 为30
reply 回应的数据包,源地址 192.168.1.1去往 192.168.1.2 是802.1Q的帧,VLAN ID 为10
手机扫一扫
移动阅读更方便
你可能感兴趣的文章