VLAN_Trunk_VTP

實驗目的
通過本實驗,掌握可以如下技能:
1、VLAN的創建、修改、刪除
2、將交換機端口分配到某個VLAN
3、配置交換機接口Trunk模式,理解DTP協商
4、理解VTP三種模式,熟悉VTP的配置,理解VTP pruning
5、熟悉配置SVI接口
實驗拓撲
94338890[6]
實驗過程
(1) 創建VLAN的兩種配置模式:全局配置模式和VLAN數據庫配置模式
        交換機VLAN信息單獨存放在flash:vlan.dat文件中,要完全清除交換機的配置,必須先"erase start-config",然後"delete flash:vlan.dat"把VLAN數據刪除
        刪除某一VLAN時,需先把在該VLAN的端口劃分到其他VLAN中,否則端口會進入"非活躍"狀態,而且show vlan 中無法看到接口。
全局配置模式
Sw_Server(config)#vlan 10
Sw_Server(config-vlan)#name ABC //VLAN10的名字ABC
Sw_Server(config-vlan)#exi
VLAN數據庫配置模式
Sw_Server#vlan database
Sw_Server(vlan)#vlan 20 name DEF
Sw_Server(vlan)#exit                      //此命令必須敲,作用創建和退出
(2) 將端口劃分到VLAN中
Sw_Server(config)#int f0/2
Sw_Server(config-if)#switchport mode access  //指定接入模式,此接口接接入設備
Sw_Server(config-if)#switchport access vlan 10 //將f0/2接口劃分到VLAN10中
Sw_Server(config-if)#no shutdown
 
Sw_Trans(config)#int f0/3
Sw_Trans(config-if)#switchport mode access
Sw_Trans(config-if)#switchport access vlan 20
% Access VLAN does not exist. Creating vlan 20 //交換機中沒有LVAN20,自動創建
Sw_Trans(config-if)#no sh
(3) 交換機之間連接端口協商起Trunk
        Native VLAN的數據不會被重新封裝,如果鏈路兩端的Native VLAN不一致,交換機會報錯。 
在Trunk鏈路中還可以配置允許哪些VLAN通過,命令:switchport trunk allowed vlan 1,10,20,1002-1005,這裏爲了測試VTP不進行設置.。
Sw_Server(config)#int f0/1
Sw_Server(config-if)#switchport trunk encapsulation dot1q //Trunk封裝模式:dot1q、另外還有cisco私有的ISL封裝模式
Sw_Server(config-if)#switchport mode dynamic desirable //DTP協商,desirable:渴望形成Trunk,收發DTP報文
Sw_Server(config-if)#switchport trunk native vlan 99 //Native VLAN不打tag標記,交換機之間Native VLAN必須一致。
Sw_Server(config-if)#no sh
Sw_Trans(config)#int f0/1
Sw_Trans(config-if)#switchport trunk encapsulation dot1q
Sw_Trans(config-if)#switchport mode dynamic auto //dynamic auto 只收不發DTP報文,願意成爲Trunk模式
Sw_Trans(config-if)#switchport trunk native vlan 99
Sw_Trans(config-if)#no sh
Sw_Trans(config)#int f0/2
Sw_Trans(config-if)#switchport trunk encapsulation dot1q
Sw_Trans(config-if)#switchport mode trunk //強制開啓Trunk,不管鄰近是接口什麼模式
Sw_Trans(config-if)#switchport nonegotiate //禁止DTP,配合Trunk使用
Sw_Trans(config-if)#switchport trunk native vlan 99
Sw_Trans(config-if)#no sh
Sw_Client(config)#int f0/1
Sw_Client(config-if)#switchport mode trunk
Sw_Client(config-if)#switchport nonegotiate
Sw_Client(config-if)#switchport trunk native vlan 99
Sw_Client(config-if)#no sh
(4) VTP三種模式:server、transparent、client,VTP默認版本1、server模式,不屬於任何域。
Server模式:增刪改VLAN信息,同步VLAN信息,保存在NVRAM中
Transparent模式:本地增刪改VLAN信息,不同步VLAN信息,保存NVRAM中
Client模式:不能增刪改VLAN信息,同步VLAN信息,不能保存在NVRAM中
VTP同步:配置版本號低的向配置版本號高的同步。
VTP Pruning:在Trunk鏈路上修剪不必要的流量。
VTP三要素:Trunk、domain、password
Sw_Server(config)#vtp mode server //VTP server模式
Sw_Server(config)#vtp domain cisco //VTP域名cisco
Sw_Server(config)#vtp password cisco1 //VTP認證,密碼cisco1
Sw_Server(config)#vtp version 2 //開啓VTP版本2
Sw_Server(config)#vtp pruning //VTP修剪,PT模擬器不支持。
Sw_Trans(config)#vtp mode transparent //VTP Transparent模式
Sw_Trans(config)#vtp domain cisco
Sw_Trans(config)#vtp password cisco1
Sw_Trans(config)#vtp version 2
Sw_Client#vlan database //VLAN 數據庫配置模式
Sw_Client(vlan)#vtp client //VTP client模式
Sw_Client(vlan)#vtp domain cisco
Sw_Client(vlan)#vtp password cisco1
Sw_Client(vlan)#vtp v2-mode //開啓VTP版本2
Sw_Client(vlan)#exit
(5) 配置SVI管理地址
Sw_Server(config)#int vlan 1 //創建SVI接口
Sw_Server(config-if)#ip address 192.168.1.1 255.255.255.0 //配置IP地址
Sw_Server(config-if)#no sh
Sw_Trans(config)#int vlan 1
Sw_Trans(config-if)#ip address 192.168.1.2 255.255.255.0
Sw_Trans(config-if)#no sh
Sw_Client(config)#int vlan 1
Sw_Client(config-if)#ip add 192.168.1.3 255.255.255.0
Sw_Client(config-if)#no sh
實驗驗證
查看VLAN信息和端口處於哪個VLAN:show vlan / show vlan brief
 
90633772[6]
 
查看Trunk模式是否形成、Native VLAN等:show interface trunk
 
90792191[6]
 
查看VTP信息:show vtp status
 
90931516[6]
 
查看VTP密碼:show vtp password
 
91003994[6]
 
查看SVI接口信息:show ip interface brief
 
91703814[6]
91725561[6]
 
        驗證VLAN信息的同步,在server上查看VLAN和VTP信息(上面有圖show vlan brief 和show vtp status)
       添加修改刪除VLAN信息後再查看VTP信息,配置版本號已經發生改變,修改一次加1
Sw_Server(config)#vlan 100
Sw_Server(config-vlan)#name AAA
Sw_Server(config-vlan)#exi
Sw_Server(config)#vlan 100
Sw_Server(config-vlan)#name BBB
Sw_Server(config-vlan)#exi
Sw_Server(config)#no vlan 100 //刪除VLAN
 
92417503[6]
 
配置版本號從上面的1變成了5,再看Client端也變成了5,VLAN信息同步沒有問題
 
92544270[6]
 
測試SVI的連通性
 
92736073[6]

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章