VTP(VLAN Trunking Protocol)詳解
Notes:
- VTP 不生成 trunk 介面,但是需要 trunk links 來發送同步資訊
- VTP 只同步 switch 中的 vlan database,不同步連線該 vlan 下的PC端介面資訊,需要手動配置
- VTP 配置儲存在 vlan.dat 中
- Well-known Multicast Address - CDP/VTP
VTP Revision Number
每當同一域名 domain 下的交換機發生 VLAN 的改變,如新增、刪除、重新命名 VLAN,該 VTP revision number 自動加 1。
當 VLAN 變化時:
- VTP server 首先發送 VTP summary advertisement 到該域名下的所有交換機;
- 各個交換機接收後傳送 advertisement request 至該 VTP server 請求改變;
- 最後 VTP server 傳送 subset advertisement 到各交換機上修改 VLAN 資訊。
Notes:具體參考 VTP Messages。
VTP Domain(域名)
VTP 預設 domain 為 NULL,所有 NULL domain 的交換機不處於同一 domain 下,相互之間不同步資訊。但當 NULL domain 的交換機接收到其他交換機發送的同步請求時,該NULL domain 交換機會自動加入該 domain。
手動設定 VTP domain 如下:
switch(config)# vtp domain cisco
VTP Messages
- Summary Adertisement
- 預設每 5s 傳送一次請求,或當 VLAN 有變化時;
- 通報同 domain 下的其他交換機新的 VTP revision number。
- Summary/Advertisement Request
- 當交換機重啟時;
- 當 VTP domain 發生變化時;
- 當該交換機接收到有更高 revision number 的 VTP summary advertisement
- Subset Advertisement(VLAN database 的具體變化資訊)
- 包含 VLAN 資訊列表
- 當有多於一個 VLAN 時,需要請求 Subset Advertisement
四類 VTP Modes
- VTP Server - Default
- Create/modify/delete VLANs; // 建立、修改、刪除 VLAN
- Synchronizes local database; // 同步本地 database
- Save the VLAN configuration information. // 儲存 VLAN 配置資訊
- VTP Client
- 不能建立、修改、刪除 VLANs;
- 可以傳送、接收 advertisement;
- 同步 database.
! ! ! Notes:
當 client 的 revision number 高於同 domain 下的其他 servers 時,client 可以 override servers 中的 VLAN 資訊 (高危!!!)
將交換機接入 domain 時,為避免此情況,正確做法如下:
a. 將 VTP mode 設為 transparent 模式;
b. 增加、修改、刪除 VLANs;
b. 將 VTP mode 調整為 cliend 模式,接入 VLAN 域中。
原因: 透明模式下 VTP revision number 為 0,永遠比 domain 中的其他交換機要低,所以不會汙染其他交換機中的 VLANs 配置資訊。
- VTP Transparent
- 不參與 VTP 配置;
- 不傳送、接收 advertisement 到其他交換機或本地交換機;
- 不同步 VLAN 配置資訊。
Note: VTP version 2 中,透明模式會發送在其 trunk 埠接收到的 VTP advertisements
- Off Mode
功能與透明模式相同,但是不傳送 VTP advertisement。
VTP Version
- Version 1 & 2 (default by version 1)
Standard VLANs (1 - 1005):
- VLAN 1 reserved for Ethernet;
- VLANs 1002 - 1005 reserved for FDDI & token ring .
- Version 3
Extented VLANs (1006 - 4094):
需要配置擴充套件 VLANs 時,VTP 必須處於 Transparent 模式下,且交換機必須為三層交換機。
VTP Pruning
為了防止交換機在接收到某一 VLAN 資料後泛洪到同一 domain 下其他所有交換機中,通過在 VTP server 上設定 VTP pruning,可使得 trunk 接收端交換機直接將該資料傳送到對應的 VLAN 中。
VTP pruning 只能在 VTP server 模式下使用,且只作用於 standard VLANs(1-1005)。
常用命令
switch# show vtp status
switch(config)# vtp mode client/server/transparent // 三種vtp模式
switch(config)# vtp version 1/2/3 // 一般使用 version 2