1. 程式人生 > >VLAN通信與以太網通道

VLAN通信與以太網通道

vlan trunk 以太網通道 不同vlan通信

VLAN(Vlan Local Area Network,虛擬局域網)技術,可以從邏輯上將一個大的網絡劃分為若幹個小的虛擬局域網,VLAN技術不僅能夠控制廣播,還可以增強網絡的安全性。VLAN工作在OSI參考模型的數據鏈路層,一個VLAN就是一個交換網絡,其中的所有用戶都在同一個廣播域中,各VLAN通過路由設備的連接實現通信。

VLAN的優勢

??給局域網的設計增加了靈活性,使管理員在劃分工作組時,不再受限於用戶所在的物理位置。具有靈活性和可擴展性等特點,還有以下好處:

  1. 控制廣播
  2. 增強網絡安全性
  3. 簡化網絡管理

VLAN種類

靜態VLAN:基於端口的VLAN,是目前常見的實現方式
動態VLAN

:基於MAC地址的動態VLAN


VLAN Trunk

trunk的作用:為了實現不同交換機上的相同VLAN之間的通信。
在交換網絡中,有兩種類型鏈路:接入鏈路和中繼鏈路。
接入鏈路:通常屬於一個VLAN,客戶機與交換機之間的鏈路就是接入鏈路;
中繼鏈路:可以承載多個VLAN,交換機與交換機之間的鏈路為中繼鏈路實現承載多條VLAN通信;


EthernetChannel(以太網通道)

通過捆綁多條以太鏈路來進行提高帶寬,並運行一種機制將多條物理鏈路捆綁成一條邏輯鏈路。
以太網通道遵循以下規則:

  1. 參與捆綁的端口必須屬於同一個VLAN;
  2. 鏈路兩端的端口必須一致,如交換機某端口為中繼模式那麽相鄰交換機的那個端口也必須為中繼模式;
  3. 所有參與捆綁的端口物理參數必須相同,應該有相同的速率和雙工模式;

實驗環境

GNS 3

實驗拓撲圖

技術分享圖片

配置命令

SW1配置

SW1>en
SW1#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW1(config)#no ip routing                #關閉路由
SW1(config)#vlan 10,20               #創建vlan10,vlan20
SW1(config-vlan)#ex
SW1(config)#int f1/0
SW1(config-if)#sw mo acc
SW1(config-if)#sw acc vlan 10               #將接口加入vlan10
SW1(config-if)#ex
SW1(config)#int f1/1
SW1(config-if)#sw mo acc
SW1(config-if)#sw acc vlan 20               #將接口加入vlan20
SW1(config-if)#ex
SW1(config)#int f1/2
SW1(config-if)#sw mo tr
SW1(config-if)#sw tr en dot1q               #該接口封裝協議dot1q
SW1(config-if)#ex
SW1(config)#int f1/3
SW1(config-if)#sw mo tr
SW1(config-if)#sw tr en dot1q               #該接口封裝協議dot1q
SW1(config-if)#ex
SW1(config)#int rang f1/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:07:38.235: %EC-5-BUNDLE: Interface Fa1/2 joined port-channel Po1
*Mar  1 00:07:38.295: %EC-5-BUNDLE: Interface Fa1/3 joined port-channel Po1
SW1(config-if-range)#end
SW1#
*Mar  1 00:07:41.195: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
SW1#
*Mar  1 00:07:42.655: %SYS-5-CONFIG_I: Configured from console by console
SW1#show etherchannel 1 summary               #查看以太網通道
Flags:  D - down        P - in port-channel
        I - stand-alone s - suspended
        R - Layer3      S - Layer2
        U - in use
Group Port-channel  Ports
-----+------------+-----------------------------------------------------------
1     Po1(SU)     Fa1/2(P)   Fa1/3(P)

SW2配置

SW2>en
SW2#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
SW2(config)#no ip routing                #關閉路由
SW2(config)#vlan 10,20               #創建vlan10,vlan20
SW2(config-vlan)#ex
SW2(config)#int f1/0
SW2(config-if)#sw mo acc
SW2(config-if)#sw acc vlan 10               #將接口加入vlan10
SW2(config-if)#ex
SW2(config)#int f1/1
SW2(config-if)#sw mo acc
SW2(config-if)#sw acc vlan 20               #將接口加入vlan20
SW2(config-if)#ex
SW2(config)#int f1/2
SW2(config-if)#sw mo tr
*Mar  1 00:09:15.299: %DTP-5-TRUNKPORTON: Port Fa1/2 has become dot1q trunk
SW2(config-if)#sw tr en dot1q               #該接口封裝協議dot1q
SW2(config-if)#ex
SW2(config)#int f1/3
SW2(config-if)#sw mo tr
*Mar  1 00:09:31.679: %DTP-5-TRUNKPORTON: Port Fa1/3 has become dot1q trunk
SW2(config-if)#sw tr en dot1q               #該接口封裝協議dot1q
SW2(config-if)#ex
SW2(config)#channel
SW2(config)#int rang f1/2 - 3
SW2(config-if-range)#channel-group 1 mode on               #建立以太網通道
Creating a port-channel interface Port-channel1
*Mar  1 00:10:03.419: %EC-5-BUNDLE: Interface Fa1/2 joined port-channel Po1
*Mar  1 00:10:03.475: %EC-5-BUNDLE: Interface Fa1/3 joined port-channel Po1
SW2(config-if-range)#end
SW2#
*Mar  1 00:10:06.391: %LINEPROTO-5-UPDOWN: Line protocol on Interface Port-channel1, changed state to up
*Mar  1 00:10:06.775: %SYS-5-CONFIG_I: Configured from console by console
SW2#show etherchannel 1 summary               #查看以太網通道
Flags:  D - down        P - in port-channel
        I - stand-alone s - suspended
        R - Layer3      S - Layer2
        U - in use
Group Port-channel  Ports
-----+------------+-----------------------------------------------------------
1     Po1(SU)     Fa1/2(P)   Fa1/3(P)

實驗結果

技術分享圖片
技術分享圖片

VLAN通信與以太網通道