天天看點

Trunk 實作跨交換機 VLAN 通信實驗拓撲配置方法配置過程PING 測試以太網通道最後

Trunk 實作跨交換機 VLAN 通信實驗拓撲配置方法配置過程PING 測試以太網通道最後

當網絡中有多台交換機時,位于不同交換機上的相同

VLAN

的主機之間時如何通信的呢?我們使用

Trunk

實作跨交換機

VLAN

通信。還有

以太網通道

的操作哦。

實驗拓撲

Trunk 實作跨交換機 VLAN 通信實驗拓撲配置方法配置過程PING 測試以太網通道最後

兩台交換機直連,每台下面再連接配接兩台

VPC

,劃分

VLAN

,位址規劃如下:

名稱 接口 VLAN 位址
PC1 SW1-f1/0 vlan 10 192.168.10.10/24
PC2 SW1-f1/1 vlan 20 192.168.10.20/24
PC3 SW2-f1/0 vlan 10 192.168.10.30/24
PC4 SW2-f1/1 vlan 20 192.168.10.40/24

配置方法

SW1(config)#interface fastEthernet 1/2
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#end
           

配置過程

交換機劃分 VLAN

  • SW1
SW1#conf t
SW1(config)#no ip routing
SW1(config)#vlan 10,20
SW1(config-vlan)#ex
SW1(config)#int f1/0
SW1(config-if)#sw m a
SW1(config-if)#sw a v 10
SW1(config-if)#ex
SW1(config)#int f1/1
SW1(config-if)#sw m a
SW1(config-if)#sw a v 20
SW1(config-if)#ex
SW1(config)#do show vlan-sw b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/2, Fa1/3, Fa1/4, Fa1/5
                                                Fa1/6, Fa1/7, Fa1/8, Fa1/9
                                                Fa1/10, Fa1/11, Fa1/12, Fa1/13
                                                Fa1/14, Fa1/15
10   VLAN0010                         active    Fa1/0
20   VLAN0020                         active    Fa1/1
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup
           
  • SW2
SW2#conf t
SW2(config)#no ip routing
SW2(config)#vlan 10,20
SW2(config-vlan)#ex
SW2(config)#int f1/0
SW2(config-if)#sw m a
SW2(config-if)#sw a v 10
SW2(config-if)#ex
SW2(config)#int f1/1
SW2(config-if)#sw m a
SW2(config-if)#sw a v 20
SW2(config-if)#ex
SW2(config)#do show vlan-sw b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Fa1/2, Fa1/3, Fa1/4, Fa1/5
                                                Fa1/6, Fa1/7, Fa1/8, Fa1/9
                                                Fa1/10, Fa1/11, Fa1/12, Fa1/13
                                                Fa1/14, Fa1/15
10   VLAN0010                         active    Fa1/0
20   VLAN0020                         active    Fa1/1
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup
           

配置 Trunk

  • SW1
SW1(config)#interface fastEthernet 1/2
SW1(config-if)#switchport mode trunk
SW1(config-if)#switchport trunk encapsulation dot1q
SW1(config-if)#end
           
  • 查詢驗證
SW1#show interfaces fastEthernet 1/2 switchport
Name: Fa1/2
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1,10,20
Protected: false
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
           
  • SW2
SW2(config)#int f1/2
SW2(config-if)#sw m t
SW2(config-if)#sw t e d
SW2(config-if)#do show int f1/2 switchport
Name: Fa1/2
Switchport: Enabled
Administrative Mode: trunk
Operational Mode: trunk
Administrative Trunking Encapsulation: dot1q
Operational Trunking Encapsulation: dot1q
Negotiation of Trunking: Disabled
Access Mode VLAN: 0 ((Inactive))
Trunking Native Mode VLAN: 1 (default)
Trunking VLANs Enabled: ALL
Trunking VLANs Active: 1,10,20
Protected: false
Priority for untagged frames: 0
Override vlan tag priority: FALSE
Voice VLAN: none
Appliance trust: none
           

PING 測試

  • PC1
PC1> ip 192.168.10.10
Checking for duplicate address...
PC1 : 192.168.10.10 255.255.255.0

PC1> ping 192.168.10.20
host (192.168.10.20) not reachable

PC1> ping 192.168.10.30
84 bytes from 192.168.10.30 icmp_seq=1 ttl=64 time=1.876 ms
84 bytes from 192.168.10.30 icmp_seq=2 ttl=64 time=1.853 ms
84 bytes from 192.168.10.30 icmp_seq=3 ttl=64 time=1.992 ms
84 bytes from 192.168.10.30 icmp_seq=4 ttl=64 time=0.000 ms
84 bytes from 192.168.10.30 icmp_seq=5 ttl=64 time=1.853 ms

PC1> ping 192.168.10.40
host (192.168.10.40) not reachable
           

PC1 PING PC3 抓包

  • SW1

    F1/0

    接口開啟抓包
Trunk 實作跨交換機 VLAN 通信實驗拓撲配置方法配置過程PING 測試以太網通道最後
  • SW1

    F1/2

    接口開啟抓包
Trunk 實作跨交換機 VLAN 通信實驗拓撲配置方法配置過程PING 測試以太網通道最後
資料包在出交換機時被打上

vlan 10

的标簽。
  • PC2
PC2> ip 192.168.10.20
Checking for duplicate address...
PC1 : 192.168.10.20 255.255.255.0

PC2> ping 192.168.10.10
host (192.168.10.10) not reachable

PC2> ping 192.168.10.30
host (192.168.10.30) not reachable

PC2> ping 192.168.10.40
84 bytes from 192.168.10.40 icmp_seq=1 ttl=64 time=1.992 ms
84 bytes from 192.168.10.40 icmp_seq=2 ttl=64 time=1.999 ms
84 bytes from 192.168.10.40 icmp_seq=3 ttl=64 time=1.870 ms
84 bytes from 192.168.10.40 icmp_seq=4 ttl=64 time=1.842 ms
84 bytes from 192.168.10.40 icmp_seq=5 ttl=64 time=1.846 ms
           

PC2 PING PC4 抓包

  • SW1

    F1/1

    接口開啟抓包
Trunk 實作跨交換機 VLAN 通信實驗拓撲配置方法配置過程PING 測試以太網通道最後
  • SW1

    F1/2

    接口開啟抓包
Trunk 實作跨交換機 VLAN 通信實驗拓撲配置方法配置過程PING 測試以太網通道最後
資料包在出交換機時被打上

vlan 20

的标簽。
  • PC3
PC3> ip 192.168.10.30
Checking for duplicate address...
PC1 : 192.168.10.30 255.255.255.0

PC3> ping 192.168.10.10
84 bytes from 192.168.10.10 icmp_seq=1 ttl=64 time=1.878 ms
84 bytes from 192.168.10.10 icmp_seq=2 ttl=64 time=1.849 ms
84 bytes from 192.168.10.10 icmp_seq=3 ttl=64 time=1.840 ms
84 bytes from 192.168.10.10 icmp_seq=4 ttl=64 time=1.842 ms
84 bytes from 192.168.10.10 icmp_seq=5 ttl=64 time=1.845 ms

PC3> ping 192.168.10.20
host (192.168.10.20) not reachable

PC3> ping 192.168.10.40
host (192.168.10.40) not reachable
           
  • PC4
PC4> ip 192.168.10.40
Checking for duplicate address...
PC1 : 192.168.10.40 255.255.255.0

PC4> ping 192.168.10.10
host (192.168.10.10) not reachable

PC4> ping 192.168.10.20
84 bytes from 192.168.10.20 icmp_seq=1 ttl=64 time=1.962 ms
84 bytes from 192.168.10.20 icmp_seq=2 ttl=64 time=1.994 ms
84 bytes from 192.168.10.20 icmp_seq=3 ttl=64 time=1.981 ms
84 bytes from 192.168.10.20 icmp_seq=4 ttl=64 time=1.991 ms
84 bytes from 192.168.10.20 icmp_seq=5 ttl=64 time=1.965 ms

PC4> ping 192.168.10.30
host (192.168.10.30) not reachable
           

以太網通道

建立以太網通道可以增加鍊路的帶寬,以及可靠性。

拓撲圖

在目前實驗的基礎上,在交換機之間增加一條鍊路。
Trunk 實作跨交換機 VLAN 通信實驗拓撲配置方法配置過程PING 測試以太網通道最後

配置過程

接口配成 Trunk

  • SW1
SW1#conf t
SW1(config)#int f1/3
SW1(config-if)#sw m t
SW1(config-if)#sw t e d
SW1(config-if)#no sh
           
  • SW2
SW2#conf t
SW2(config)#int f1/3
SW2(config-if)#sw m t
SW2(config-if)#sw t e d
SW2(config-if)#no sh
           

接口綁定到一起

  • SW1
SW1(config-if)#exit
SW1(config)#int range fastEthernet 1/2 - 3
SW1(config-if-range)#channel-group 1 mode on
Creating a port-channel interface Port-channel1
SW1(config-if-range)#
*Mar  1 00:56:50.555: %EC-5-BUNDLE: Interface Fa1/2 joined port-channel Po1
SW1(config-if-range)#
*Mar  1 00:56:53.487: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
           
  • SW2
SW2(config-if)#ex
SW2(config)#int r f1/2 - 3
SW2(config-if-range)#ch 1 m o
Creating a port-channel interface Port-channel1
SW2(config-if-range)#
*Mar  1 01:00:16.955: %EC-5-BUNDLE: Interface Fa1/2 joined port-channel Po1
SW2(config-if-range)#
*Mar  1 01:00:19.875: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
           

故障模拟

驗證以太網通道的可靠性,斷開兩個交換機的

f1/2

接口,檢視連通性。事先使用

PC1

PC3

進行長

PING

  • 斷開接口
SW1(config-if-range)#ex
SW1(config)#int f1/2
SW1(config-if)#sh
SW1(config-if)#
*Mar  1 01:05:35.947: %EC-5-UNBUNDLE: Interface Fa1/2 left the port-channel Po1
*Mar  1 01:05:35.995: %EC-5-BUNDLE: Interface Fa1/3 joined port-channel Po1
*Mar  1 01:05:36.451: %DTP-5-NONTRUNKPORTON: Port Fa1/2 has become non-trunk
*Mar  1 01:05:36.491: %DTP-5-TRUNKPORTON: Port Fa1/3 has become dot1q trunk
SW1(config-if)#
*Mar  1 01:05:37.887: %LINK-5-CHANGED: Interface FastEthernet1/2, changed state to administratively down
SW1(config-if)#
*Mar  1 01:05:37.947: %LINK-3-UPDOWN: Interface Port-channel1, changed state to up
SW1(config-if)#
*Mar  1 01:05:38.887: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/2, changed state to down
*Mar  1 01:05:38.991: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/3, changed state to up
           
SW2(config-if-range)#ex
SW2(config)#int f1/2
SW2(config-if)#sh
SW2(config-if)#
*Mar  1 01:06:57.415: %EC-5-UNBUNDLE: Interface Fa1/2 left the port-channel Po1
*Mar  1 01:06:57.447: %EC-5-BUNDLE: Interface Fa1/3 joined port-channel Po1
*Mar  1 01:06:57.915: %DTP-5-NONTRUNKPORTON: Port Fa1/2 has become non-trunk
*Mar  1 01:06:57.947: %DTP-5-TRUNKPORTON: Port Fa1/3 has become dot1q trunk
SW2(config-if)#
*Mar  1 01:06:59.375: %LINK-5-CHANGED: Interface FastEthernet1/2, changed state to administratively down
SW2(config-if)#
*Mar  1 01:06:59.411: %LINK-3-UPDOWN: Interface Port-channel1, changed state to up
SW2(config-if)#
*Mar  1 01:07:00.375: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/2, changed state to down
*Mar  1 01:07:00.443: %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet1/3, changed state to up
           
  • PING 測試
PC1> ping 192.168.10.30 -t
84 bytes from 192.168.10.30 icmp_seq=1 ttl=64 time=1.975 ms
84 bytes from 192.168.10.30 icmp_seq=2 ttl=64 time=1.866 ms
84 bytes from 192.168.10.30 icmp_seq=3 ttl=64 time=1.849 ms
84 bytes from 192.168.10.30 icmp_seq=4 ttl=64 time=0.978 ms
84 bytes from 192.168.10.30 icmp_seq=5 ttl=64 time=1.851 ms
84 bytes from 192.168.10.30 icmp_seq=6 ttl=64 time=1.842 ms
84 bytes from 192.168.10.30 icmp_seq=7 ttl=64 time=1.896 ms
84 bytes from 192.168.10.30 icmp_seq=8 ttl=64 time=1.879 ms
84 bytes from 192.168.10.30 icmp_seq=9 ttl=64 time=1.877 ms
84 bytes from 192.168.10.30 icmp_seq=10 ttl=64 time=1.853 ms
84 bytes from 192.168.10.30 icmp_seq=11 ttl=64 time=1.988 ms
84 bytes from 192.168.10.30 icmp_seq=12 ttl=64 time=1.846 ms
84 bytes from 192.168.10.30 icmp_seq=13 ttl=64 time=1.839 ms
84 bytes from 192.168.10.30 icmp_seq=14 ttl=64 time=1.996 ms
84 bytes from 192.168.10.30 icmp_seq=15 ttl=64 time=1.847 ms
84 bytes from 192.168.10.30 icmp_seq=16 ttl=64 time=1.862 ms
84 bytes from 192.168.10.30 icmp_seq=17 ttl=64 time=1.847 ms
84 bytes from 192.168.10.30 icmp_seq=18 ttl=64 time=1.886 ms
84 bytes from 192.168.10.30 icmp_seq=19 ttl=64 time=1.849 ms
84 bytes from 192.168.10.30 icmp_seq=20 ttl=64 time=1.844 ms
84 bytes from 192.168.10.30 icmp_seq=21 ttl=64 time=1.886 ms
84 bytes from 192.168.10.30 icmp_seq=22 ttl=64 time=1.844 ms
84 bytes from 192.168.10.30 icmp_seq=23 ttl=64 time=1.889 ms
84 bytes from 192.168.10.30 icmp_seq=24 ttl=64 time=1.858 ms
84 bytes from 192.168.10.30 icmp_seq=25 ttl=64 time=1.965 ms
84 bytes from 192.168.10.30 icmp_seq=26 ttl=64 time=1.842 ms
84 bytes from 192.168.10.30 icmp_seq=27 ttl=64 time=1.848 ms
84 bytes from 192.168.10.30 icmp_seq=28 ttl=64 time=1.997 ms
84 bytes from 192.168.10.30 icmp_seq=29 ttl=64 time=1.843 ms
84 bytes from 192.168.10.30 icmp_seq=30 ttl=64 time=1.972 ms
84 bytes from 192.168.10.30 icmp_seq=31 ttl=64 time=1.847 ms
84 bytes from 192.168.10.30 icmp_seq=32 ttl=64 time=1.844 ms
84 bytes from 192.168.10.30 icmp_seq=33 ttl=64 time=0.968 ms
192.168.10.30 icmp_seq=34 timeout
192.168.10.30 icmp_seq=35 timeout
192.168.10.30 icmp_seq=36 timeout
192.168.10.30 icmp_seq=37 timeout
192.168.10.30 icmp_seq=38 timeout
192.168.10.30 icmp_seq=39 timeout
192.168.10.30 icmp_seq=40 timeout
192.168.10.30 icmp_seq=41 timeout
192.168.10.30 icmp_seq=42 timeout
192.168.10.30 icmp_seq=43 timeout
192.168.10.30 icmp_seq=44 timeout
192.168.10.30 icmp_seq=45 timeout
192.168.10.30 icmp_seq=46 timeout
192.168.10.30 icmp_seq=47 timeout
192.168.10.30 icmp_seq=48 timeout
192.168.10.30 icmp_seq=49 timeout
192.168.10.30 icmp_seq=50 timeout
192.168.10.30 icmp_seq=51 timeout
192.168.10.30 icmp_seq=52 timeout
192.168.10.30 icmp_seq=53 timeout
192.168.10.30 icmp_seq=54 timeout
192.168.10.30 icmp_seq=55 timeout
192.168.10.30 icmp_seq=56 timeout
192.168.10.30 icmp_seq=57 timeout
192.168.10.30 icmp_seq=58 timeout
192.168.10.30 icmp_seq=59 timeout
192.168.10.30 icmp_seq=60 timeout
192.168.10.30 icmp_seq=61 timeout
192.168.10.30 icmp_seq=62 timeout
192.168.10.30 icmp_seq=63 timeout
192.168.10.30 icmp_seq=64 timeout
192.168.10.30 icmp_seq=65 timeout
192.168.10.30 icmp_seq=66 timeout
192.168.10.30 icmp_seq=67 timeout
192.168.10.30 icmp_seq=68 timeout
192.168.10.30 icmp_seq=69 timeout
192.168.10.30 icmp_seq=70 timeout
192.168.10.30 icmp_seq=71 timeout
192.168.10.30 icmp_seq=72 timeout
192.168.10.30 icmp_seq=73 timeout
192.168.10.30 icmp_seq=74 timeout
192.168.10.30 icmp_seq=75 timeout
192.168.10.30 icmp_seq=76 timeout
192.168.10.30 icmp_seq=77 timeout
192.168.10.30 icmp_seq=78 timeout
192.168.10.30 icmp_seq=79 timeout
192.168.10.30 icmp_seq=80 timeout
192.168.10.30 icmp_seq=81 timeout
192.168.10.30 icmp_seq=82 timeout
192.168.10.30 icmp_seq=83 timeout
192.168.10.30 icmp_seq=84 timeout
192.168.10.30 icmp_seq=85 timeout
192.168.10.30 icmp_seq=86 timeout
192.168.10.30 icmp_seq=87 timeout
192.168.10.30 icmp_seq=88 timeout
192.168.10.30 icmp_seq=89 timeout
84 bytes from 192.168.10.30 icmp_seq=90 ttl=64 time=1.846 ms
84 bytes from 192.168.10.30 icmp_seq=91 ttl=64 time=1.982 ms
84 bytes from 192.168.10.30 icmp_seq=92 ttl=64 time=1.840 ms
84 bytes from 192.168.10.30 icmp_seq=93 ttl=64 time=1.849 ms
84 bytes from 192.168.10.30 icmp_seq=94 ttl=64 time=1.841 ms
84 bytes from 192.168.10.30 icmp_seq=95 ttl=64 time=1.846 ms
84 bytes from 192.168.10.30 icmp_seq=96 ttl=64 time=1.841 ms
84 bytes from 192.168.10.30 icmp_seq=97 ttl=64 time=1.861 ms
84 bytes from 192.168.10.30 icmp_seq=98 ttl=64 time=0.844 ms
84 bytes from 192.168.10.30 icmp_seq=99 ttl=64 time=0.833 ms
           

最後

這是關于使用

Trunk

實作跨交換機

VLAN

通信的實驗,和以太網通道怎麼建立方法。下一篇關于三層交換的實驗。

轉載于:https://www.cnblogs.com/llife/p/11329350.html