cisco VTP協議


當交換機多了的時候,維護每台交換機的vlan,也是挺麻煩的,而且容器出錯。

有沒有一種辦法,只手動維護一台交換機的vlan,然后其他的vlan都自動同步獲得其配置的vlan,但每台交換機下接口的划分是不同步的。

cisco 專用的VTP協議可以滿足上面的需求。

只能用trunk接口傳遞vlan

VTP協議要素

實驗:把server的vlan同步到client1和transparent

1,設置trunk接口

server:把e0/0和e0/1接口設置成trunk接口

同時修改多個接口:int ran e0/0-1

server(config)#int ran e0/0-1
server(config-if-range)#switchport trunk encapsulation dot1q
server(config-if-range)#sw mo trunk

client1:把e0/0接口設置成trunk接口

client1(config)#int e0/0
client1(config-if)#sw trunk encapsulation dot1q
client1(config-if)#sw mode tr

transparent:把e0/0接口設置成trunk接口

transparent(config)#int e0/0
transparent(config-if)#sw tr en dot1q
transparent(config-if)#sw mo tr

2,給交換機分配vtp模式

查看vtp狀態命令:

server#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 :
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0100
Configuration last modified by 0.0.0.0 at 0-0-00 00:00:00
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 5
Configuration Revision            : 0
MD5 digest                        : 0x57 0xCD 0x40 0x65 0x63 0x59 0x47 0xBD
                                    0x56 0x9D 0x4A 0x3E 0xA5 0x69 0x35 0xBC
  • VTP Operating Mode : Server 交換機默認就是server模式

修改交換機client1的模式為client:

client1(config)#vtp mode client
client1(config)#exit
client1#show vtp statu
Feature VLAN:
--------------
VTP Operating Mode                : Client

修改交換機transparent的模式為transparent:

transparent(config)#vtp mode transparent
Setting device to VTP Transparent mode for VLANS.
transparent#show vtp status
Feature VLAN:
--------------
VTP Operating Mode                : Transparent

在server上建一個vlan,看看能不能同步到另外2台交換機,發現並沒有同步。

但有一個重要的變化:

  • Number of existing VLANs : 從5變成了6

  • Configuration Revision : 從0變成了1

    Configuration Revision非常重要。當換了一台server時,原來的vlan信息,只能從client或者別的server獲得,但是選項哪個呢,哪個Configuration Revision號大,就選擇誰。當新建,修改,刪除vlan時Configuration Revision都會增大。

server(config)#vlan 10
server(config-vlan)#exit
server(config)#exit
server#show vlan b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/2, Et0/3, Et1/0, Et1/1
                                                Et1/2, Et1/3, Et2/0, Et2/1
                                                Et2/2, Et2/3, Et3/0, Et3/1
                                                Et3/2, Et3/3
10   VLAN0010                         active
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

server#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 :
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0100
Configuration last modified by 0.0.0.0 at 1-17-20 14:45:41
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 6
Configuration Revision            : 1
MD5 digest                        : 0xB1 0xBE 0x72 0x49 0x96 0x6D 0x99 0xA4
                                    0xB4 0xDC 0x94 0x56 0xD4 0xC2 0x6A 0xBB

為什么沒有同步呢?由於server的VTP Domain Name(域名)還沒有配置.

3,配置server的VTP Domain Name,一旦配置了VTP Domain Name,server會馬上發送自己的域名和vlan信息給所有沒有域名的交換機的trunk接口,client接到了server的域名和vlan信息后,更新自己的域名和vlan。

server:每5分鍾發送一次vtp。

server(config)#vtp domain d1
Changing VTP domain name from NULL to d1
server#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 : d1
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0100
Configuration last modified by 0.0.0.0 at 1-17-20 14:45:41
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 6
Configuration Revision            : 1
MD5 digest                        : 0x28 0x95 0x36 0xD6 0xB7 0x58 0xC1 0xA0
                                    0xCF 0xFB 0xBC 0xF1 0xB0 0x2B 0x7F 0xAA

client:從server獲得了域名和vlan10,而且Configuration Revision也和server相同。

client1#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 : d1
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0200
Configuration last modified by 0.0.0.0 at 1-17-20 14:45:41

Feature VLAN:
--------------
VTP Operating Mode                : Client
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 6
Configuration Revision            : 1
MD5 digest                        : 0x28 0x95 0x36 0xD6 0xB7 0x58 0xC1 0xA0
                                    0xCF 0xFB 0xBC 0xF1 0xB0 0x2B 0x7F 0xAA

client1#show vlan b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/1, Et0/2, Et0/3, Et1/0
                                                Et1/1, Et1/2, Et1/3, Et2/0
                                                Et2/1, Et2/2, Et2/3, Et3/0
                                                Et3/1, Et3/2, Et3/3
10   VLAN0010                         active
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

transport:完全不同步server的vlan,只是把server的vlan信息,傳遞出去。

4,再加一台交換機server2,模式是server,設置e0/0為trunk接口,並在的server1上,添加一個vlan 20,server2馬上就獲得了,server1的vtp信息。

server#conf t
Enter configuration commands, one per line.  End with CNTL/Z.
server(config)#vlan 20

server2#show vtp status
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 : d1
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc80.0400
Configuration last modified by 0.0.0.0 at 1-17-20 15:20:26
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005
Number of existing VLANs          : 7
Configuration Revision            : 4
MD5 digest                        : 0x89 0x21 0x61 0xDD 0x49 0xED 0x7D 0x89
                                    0x67 0x72 0x75 0xFB 0xDA 0x3A 0x42 0x3E
server2#show vlan b

VLAN Name                             Status    Ports
---- -------------------------------- --------- -------------------------------
1    default                          active    Et0/1, Et0/2, Et0/3, Et1/0
                                                Et1/1, Et1/2, Et1/3, Et2/0
                                                Et2/1, Et2/2, Et2/3, Et3/0
                                                Et3/1, Et3/2, Et3/3
10   VLAN0010                         active
20   VLAN0020                         active
1002 fddi-default                     act/unsup
1003 token-ring-default               act/unsup
1004 fddinet-default                  act/unsup
1005 trnet-default                    act/unsup

在server2上,刪除vlan20后,server1和client上的vlan20,也被刪除了。

設置server的密碼

由於有可能多個server,防止某一個人,不知道這台交換機是server,隨意修改了一些vlan,導致傳播到了所有client和server。所以把server和client的密碼設置成一樣的;server2不設置密碼,然后在server上添加vlan30,發現只同步到了client,而沒有同步到server2.原因是server2的密碼和它們不同。

結論:只用域名同,密碼同,才能夠同步。

server(config)#vtp password 123
Setting device VTP password to 123

查看server的密碼:

server#show vtp password
VTP Password: 123

client模式:

  • 一旦斷電,vlan信息就沒了,開機重新同步;server和transparent斷電可以保留vlan信息。

  • 不可以在模式為client的交換機下,創建,刪除vlan

    client1(config)#vlan 30
    VTP VLAN configuration not allowed when device is in CLIENT mode.
    
  • client也可以傳遞vtp。client1可以把vtp傳遞給client2.

# c/c++ 學習互助QQ群:877684253 ![](https://img2018.cnblogs.com/blog/1414315/201811/1414315-20181106214320230-961379709.jpg) # 本人微信:xiaoshitou5854


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM