实验拓扑
实验需求
- 按图示给各 PC 配置 IP 地址
- PC1属于 VLAN 10 ; PC2 与 PC5 属于 VLAN 20;PC4属于 VLAN 30
- 实现全网互通
实验步骤
1.配置链路聚合
在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
2.验证链路聚合效果
[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
3. 在 SW1 与 SW2 上将互连的聚合接口属性设置为 Hybrid ,并允许 VLAN 10 ; VLAN 20 ; VLAN 30 通过
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
4. 在 SW1 与 SW2 上将互连 PC 的端口,赋予剥离 VLAN 10 ; VLAN 20 ; VLAN 30 标签能力,配置PVID 值和允许通过的VLAN
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
5. PING 测试连通性----- PC4 Ping PC1
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