VTP 抓包分析

# 一、VTP協議介紹
# Cisco交換機一旦經過某種方式激活了幹線(Trunk),這些交換機會經過通告報文來指示哪些VLAN是可用的,而且會維持這些VLAN的相關信息,這種功能就叫作VTP(Vlan Trunking Protocol,VLAN中繼協議)。VTP是思科私有的協議,但大多數交換機都支持該協議。

# 二、VTP的做用
# 使用VTP能夠將一臺交換機配置成VTP Server,將其他的交換機配置成VTP Client,那麼做爲VTP Client的交換機會自動同步VTP Server交換機上面配置的VLAN信息,這樣就不須要在每一臺交換機上配置相同的VLAN信息;對VTP Server上VLAN的添加和刪除重命名等操做會自動同步到VTP Client,確保了整個網絡配置的一致性。

# 三、VTP的特色
# VTP是一種消息協議,使用第二層幀,經過VLAN 1傳輸;能夠用VTP管理網絡的VLAN範圍從1到1005,VTP不能管理擴展的VLAN(大於1005)。VTP協議使用VTP通告(VTP advertisements)在交換機間交互VLAN信息,VTP通告只能在Trunk(主幹)鏈路上上互交信息。

IOU1#sh vtp statu
VTP Version capable             : 1 to 3   # 表示這臺交換支持兩種VTP版本(一、二、3),這裏顯示的3,不表明默認運行的版本是 Version 3,只表明支持幾種版本。
VTP version running             : 1                        # 默認運行的是版本1,
VTP Domain Name                 : cisco                    # VTP域名,沒有配置的時候爲空。
VTP Pruning Mode                : Disabled                 # 是否開啓了VTP裁剪功能,默認沒有開啓。
VTP Traps Generation            : Disabled                 # Trap主要用來爲SNMP服務器發送消息,默認沒有開啓。
Device ID                       : aabb.cc00.0100           # 發送VTP信息的端口IP地址,能夠手動指定發送VTP信息的端口。
Configuration last modified by 0.0.0.0 at 8-31-17 14:53:56 # 最後配置改變的時間。
Local updater ID is 0.0.0.0 (no valid interface found)

Feature VLAN:
--------------
VTP Operating Mode                : Server
Maximum VLANs supported locally   : 1005    # 表示交換機最大可配置的VLAN數量是1005個,這個值和交換機的型號有關。
Number of existing VLANs          : 9    # 當前已經有9個VLAN,交換機默認VLAN就是5個(VLAN一、VLAN1002-1005)。
Configuration Revision            : 4    # 配置修正號是4,交換機上VLAN配置信息發生改變時,配置修正號自動加1,配置修正號暗示了交換機VLAN配置信息的新舊。
MD5 digest                        : 0x44 0x23 0x1E 0xD1 0x1A 0xC3 0xB7 0xE5 
                                    0xF6 0xD6 0xDE 0x3B 0xEF 0x46 0x62 0x62 
# 四、什麼是VTP域名
# VTP協議容許在一臺交換機上集中配置,所作的配置會被自動傳播到網絡中全部其餘的交換機上,前提是這些交換機都在一個VTP域中;同一個域中的交換機擁有相同的VTP域名;默認的域名爲空,此時交換機不會向外傳播VTP通告,而且一個交換機只能加入一個VTP域。
# 注意,當VTP域名被改變或刪除閃存中的VLAN配置文件"vlan.dat",重啓後配置修正號會自動歸零;另外,當交換機處於Transparent模式時,由於不須要和其餘交換機同步VTP信息,配置修正號始終爲0;當網絡中的交換機配置修正號都爲0的時候,他們之間不會同步VLAN配置信息。
# 在同一個域中,若是沒有設置VTP密碼,只要域名相同,配置修正號大的交換機的VLAN配置將覆蓋配置修正號小的交換機的VLAN配置,這樣很是不安全,能夠經過下面的命令配置一個VTP密碼,只有域名和密碼都相同的狀況下,纔會互交VLAN配置信息:
# 五、刪除VTP domain
# 刪除vlan.dat可讓域名變成空的,但是,別的交換機給你發一個vtp通告,你的交換機會自動把vtp域名改爲這個通告裏的名字

IOU1#delete vlan.dat-00005
Delete filename [vlan.dat-00005]? 
Delete unix:/vlan.dat-00005? [confirm]
IOU1#sh vtp stat
VTP Version capable             : 1 to 3
VTP version running             : 1
VTP Domain Name                 : NULL
VTP Pruning Mode                : Disabled
VTP Traps Generation            : Disabled
Device ID                       : aabb.cc00.0500
Configuration last modified by 0.0.0.0 at 9-1-17 11:39:28
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          : 9
Configuration Revision            : 1
MD5 digest                        : 0x53 0x4C 0x99 0x60 0x77 0x26 0xD2 0x73 
                                    0x3A 0xDE 0x36 0x34 0xF4 0x2E 0xE5 0x17
# 六、VTP協議協商
# 1)VTP幀結構
# VTP被封裝在802.1Q或ISL幀中(交換機間主幹鏈路的封裝協議),VTP幀以組播的方式發送,目的MAC是保留的MAC地址"01-00-0C-CC-CC-CC"。
# VTP幀包括幀頭和信息內容:
#     VTP幀頭中包含了VTP域名、域名長度、VTP版本、VTP配置修正號、VTP信息類型(包含了三種信息類型,總彙、子集、查詢)等。
#     VTP信息內容包括MD5散列值、幀的格式(ISL或802.1Q)、每一個VLAN的配置信息(配置信息中包括:VLAN ID、VLAN名稱、類型、狀態等)。

# 2)VTP通告類型
# VTP通告有三種類型:
# 彙總通告(Summary Advertisements):彙總通告包含VTP域名、配置修正號以及配置的一些細節。彙總通告有兩種發送方式:週期性發送,每隔5分鐘被VTP Server或VTP Client發送。觸發發送,若是VTP配置發生變化VTP通告當即發送。

# 子集通告(Subset Advertisements):在建立或刪除VLAN、掛起或激活VLAN、更改VLAN名稱、改變VLAN UTM時會發送子集通告。

# 查詢通告(Request Advertisements):當VTP Server收到一個查詢通告時,VTP Server會發送一個VTP彙總通告和一個VTP子集通告。
# 下面這些狀況會發送查詢通告:VTP域名發生變化時(獲取相同域名的vlan信息)、交換機收到一個彙總通告,通告中的配置修正號高於本交換機的配置修正號、由於某些緣由子集通告丟失、交換機重啓。




# Summary Advertisement 彙總通告
Frame 257: 103 bytes on wire (824 bits), 103 bytes captured (824 bits) on interface 0
Ethernet II, Src: aa:bb:cc:00:0d:11 (aa:bb:cc:00:0d:11), Dst: CDP/VTP/DTP/PAgP/UDLD (01:00:0c:cc:cc:cc)
    Destination: CDP/VTP/DTP/PAgP/UDLD (01:00:0c:cc:cc:cc)    # VTP幀以組播的方式發送,目的MAC是保留的MAC地址"01-00-0C-CC-CC-CC"
    Source: aa:bb:cc:00:0d:11 (aa:bb:cc:00:0d:11)
    Type: 802.1Q Virtual LAN (0x8100)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 1                # VTP被封裝在802.1Q或ISL幀中
    000. .... .... .... = Priority: Best Effort (default) (0)
    ...0 .... .... .... = CFI: Canonical (0)
    .... 0000 0000 0001 = ID: 1        
    Length: 85
Logical-Link Control
    DSAP: SNAP (0xaa)
    SSAP: SNAP (0xaa)
    Control field: U, func=UI (0x03)
    Organization Code: Cisco (0x00000c)    
    PID: VTP (0x2003)
VLAN Trunking Protocol
    Version: 0x01
    Code: Summary Advertisement (0x01)
    Followers: 1
    Management Domain Length: 5
    Management Domain: cisco                # VTP domain
    Configuration Revision Number: 1        # VTP修正號
    Updater Identity: 0.0.0.0
    Update Timestamp: 17-09-02 12:43:18
    MD5 Digest: 396e186d1f15d232fa7f29739891fc52
    
# Subset Advertisements    子集通告
Frame 247: 290 bytes on wire (2320 bits), 290 bytes captured (2320 bits) on interface 0
Ethernet II, Src: aa:bb:cc:00:0d:11 (aa:bb:cc:00:0d:11), Dst: CDP/VTP/DTP/PAgP/UDLD (01:00:0c:cc:cc:cc)
    Destination: CDP/VTP/DTP/PAgP/UDLD (01:00:0c:cc:cc:cc)
    Source: aa:bb:cc:00:0d:11 (aa:bb:cc:00:0d:11)
    Type: 802.1Q Virtual LAN (0x8100)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 1
    000. .... .... .... = Priority: Best Effort (default) (0)
    ...0 .... .... .... = CFI: Canonical (0)
    .... 0000 0000 0001 = ID: 1
    Length: 272
Logical-Link Control
    DSAP: SNAP (0xaa)
    SSAP: SNAP (0xaa)
    Control field: U, func=UI (0x03)
    Organization Code: Cisco (0x00000c)
    PID: VTP (0x2003)
VLAN Trunking Protocol
    Version: 0x01
    Code: Subset Advertisement (0x02)
    Sequence Number: 1
    Management Domain Length: 4
    Management Domain: NULL
    Configuration Revision Number: 1
    VLAN Information                    # VLAN信息
        VLAN Information Length: 20
        Status: 0x00
        VLAN Type: Ethernet (0x01)
        VLAN Name Length: 7
        ISL VLAN ID: 0x0001             # 默認 vlan 1
        MTU Size: 1500
        802.10 Index: 0x000186a1
        VLAN Name: default
    VLAN Information
        VLAN Information Length: 20
        Status: 0x00
        VLAN Type: Ethernet (0x01)
        VLAN Name Length: 8
        ISL VLAN ID: 0x000a             # vlan 10
        MTU Size: 1500
        802.10 Index: 0x000186aa
        VLAN Name: VLAN0010
    VLAN Information
        VLAN Information Length: 20
        Status: 0x00
        VLAN Type: Ethernet (0x01)
        VLAN Name Length: 8
        ISL VLAN ID: 0x0014
        MTU Size: 1500
        802.10 Index: 0x000186b4
        VLAN Name: VLAN0020

# Advertisement Request 查詢通告
Frame 2973: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface 0
Ethernet II, Src: aa:bb:cc:00:0c:11 (aa:bb:cc:00:0c:11), Dst: CDP/VTP/DTP/PAgP/UDLD (01:00:0c:cc:cc:cc)
    Destination: CDP/VTP/DTP/PAgP/UDLD (01:00:0c:cc:cc:cc)
    Source: aa:bb:cc:00:0c:11 (aa:bb:cc:00:0c:11)
    Type: 802.1Q Virtual LAN (0x8100)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 1
    000. .... .... .... = Priority: Best Effort (default) (0)
    ...0 .... .... .... = CFI: Canonical (0)
    .... 0000 0000 0001 = ID: 1
    Length: 46
Logical-Link Control
    DSAP: SNAP (0xaa)
    SSAP: SNAP (0xaa)
    Control field: U, func=UI (0x03)
    Organization Code: Cisco (0x00000c)
    PID: VTP (0x2003)
VLAN Trunking Protocol
    Version: 0x01
    Code: Advertisement Request (0x03)
    Management Domain Length: 4
    Management Domain: NULL
    Start Value: 0x0000

# 思科交換機能夠被配置成3種VTP模式:
# Server模式:Server模式是思科交換機默認的VTP模式,在這種模式下的交換機能夠建立、修改、刪除VLAN,VTP Server交換機通告本身的VLAN信息給同一個域中的其餘交換機,同時也與收到的VTP通告同步VLAN信息,VLAN的配置信息保存在閃存的vlan.dat文件中。

# Client模式:工做在這種模式下的交換機不能夠建立、修改、刪除VLAN,當工做在這種模式下的交換機重啓時,它發送一個查詢通告給VTP Server,請求更新的VLAN信息。這種模式下的交換機VLAN配置信息也保存在閃存的vlan.dat文件中。
# IOU2(config)#vlan 50
# VTP VLAN configuration not allowed when device is in CLIENT mode.

# Transparent模式:工做在這種模式下的交換機能夠建立、修改、刪除VLAN,但所作的修改隻影響當前交換機。在這種模式下,交換機能夠轉發收到的VTP通告給網絡中的其餘交換機,但只是轉發,Transparent模式下的交換機並不發送本身的VTP信息給其餘交換機,也不與網絡中的其餘交換機同步信息。這種模式下的交換機的VLAN配置信息保存在running-config中,並不是保存在vlan.dat中。
# 七、VTP Pruning
# VTP修剪(VTP PRUNING)是VTP的一個功能,它能減小中繼端口上沒必要要信息量.在CISCO交換上,VTP修剪功能缺省是關閉的.
減小廣播,組播,單播,保留帶寬.VTP pruning只在trunk link上發送廣播.默認狀況,VTP pruning在全部的switches上是沒有啓用的.當你在VTP服務器上啓用了VTP pruning,整個VTP域就啓用了VTP pruning,默認只能在VLAN2到VLAN1005,VLAN1是管理VLAN。

# VTP加入消息(VTP join message):一旦你將交換機端口與一個VLAN相關聯,join消息就會宣告VLAN成員關係。此消息用於通知交換機的鄰居,此交換機但願接收發往與配置接相關聯的VLAN通訊。鄰接的交換機利用這個信息決定泛洪通訊是否須要經過這個trunk。只有在某個trunk鏈路上收到了適當的join消息,vlan通訊纔會在此trunk上傳送

# join 消息
Frame 5486: 192 bytes on wire (1536 bits), 192 bytes captured (1536 bits) on interface 0
Ethernet II, Src: aa:bb:cc:00:0d:11 (aa:bb:cc:00:0d:11), Dst: CDP/VTP/DTP/PAgP/UDLD (01:00:0c:cc:cc:cc)
    Destination: CDP/VTP/DTP/PAgP/UDLD (01:00:0c:cc:cc:cc)
    Source: aa:bb:cc:00:0d:11 (aa:bb:cc:00:0d:11)
    Type: 802.1Q Virtual LAN (0x8100)
802.1Q Virtual LAN, PRI: 0, CFI: 0, ID: 1
    000. .... .... .... = Priority: Best Effort (default) (0)
    ...0 .... .... .... = CFI: Canonical (0)
    .... 0000 0000 0001 = ID: 1
    Length: 174
Logical-Link Control
VLAN Trunking Protocol
    Version: 0x01
    Code: Join/Prune Message (0x04)
    Management Domain Length: 4
    Management Domain: NULL
    First VLAN ID: 0
    Last VLAN ID: 1007
    Advertised active (i.e. not pruned) VLANs
        VLAN: 1
        VLAN: 10
        VLAN: 30
        VLAN: 40
        VLAN: 50
# vtp pruning 有啥做用?
相關文章
相關標籤/搜索