前言:我是誰(shuí),我在哪哪审,我干嘛要學(xué)計(jì)算機(jī)網(wǎng)絡(luò)饶深?
簡(jiǎn)介 VTP
VTP 的三種模式
VTP:VLAN Trunking Protocol
一個(gè)思科私有的 VLAN TRUNK 協(xié)議餐曹,通過一個(gè)共有的管理域,維持 VLAN 配置信息的一致性敌厘;
簡(jiǎn)單來說在 VTP 里面一共有三種模式:Server Mode台猴、Client Mode、Transparent Mode
- 服務(wù)器模式 Server Mode
我們可以在 VTP 服務(wù)器模式的交換機(jī)中創(chuàng)建俱两,添加或刪除 VTP 域的VLAN饱狂,并在 VTP 服務(wù)器中更改 VLAN 信息。服務(wù)器模式中的交換機(jī)所做的更改將通告給整個(gè) VTP 域
- 客戶端模式 Client Mode
客戶端模式交換機(jī)偵聽來自其他交換機(jī)的 VTP 通告宪彩,并相應(yīng)地修改其VLAN 配置休讳。客戶端交換機(jī)需要在服務(wù)端的通知下更改 VLAN尿孔。我們無(wú)法在 VTP 客戶端中創(chuàng)建俊柔,添加或刪除 VLAN。
- 透明模式 Transparent Mode
透明模式的交換機(jī)不參與 VTP 域活合,透明模式的交換機(jī)可以通過 Trunk 接收和轉(zhuǎn)發(fā) VTP 通告
VTP 機(jī)制
- VTP 協(xié)議通過組播地址
01-00-0C-CC-CC-CC
在 Trunk 鏈路上發(fā)送 VTP 通告雏婶;
- VTP Server 和 clients 通過最高的修訂號(hào)來同步數(shù)據(jù)庫(kù);
- VTP 協(xié)議每隔 5 分鐘發(fā)送一次 VTP 通告或者有變化時(shí)發(fā)生白指;
VTP 還有另外一個(gè)機(jī)制:Pruning(修剪)
作用是減少不必要的泛洪流量(例如廣播留晚,多播和單播數(shù)據(jù)包)來增強(qiáng)網(wǎng)絡(luò)帶寬使用,簡(jiǎn)而言之就是切掉這一塊的泛洪
要使 VTP Pruning 生效侵续,管理域中的所有設(shè)備都必須支持 VTP Pruning倔丈,或者在不支持 Pruning 的設(shè)備上,必須手動(dòng)配置 Trunk 上允許的 VLAN
VTP 配置
Switch# configure terminal
Switch(config)# vtp mode [ server | client | transparent ]
Switch(config)# vtp domain domain-name
Switch(config)# vtp password password
Switch(config)# vtp pruning
Switch(config)# vtp domain ICND
Changing VTP domain name to ICND
Switch(config)# vtp mode transparent
Setting device to VTP TRANSPARENT mode.
Switch(config)# end
Switch#show vtp status
實(shí)戰(zhàn)——單臂路由
搭建環(huán)境
- 配置所有 PC 地址
VPCS> ip 192.168.10.1/24 192.168.10.254
VPCS> ip 192.168.10.2/24 192.168.10.254
VPCS> ip 192.168.20.1/24 192.168.20.254
- 配置路由器
R1(config)#int e0/0.1
R1(config-subif)#encapsulation dot1q 10
R1(config-subif)#ip add 192.168.10.254 255.255.255.0
R1(config-subif)#no shutdown
R1(config)#int e0/0.2
R1(config-subif)#encapsulation dot1q 20
R1(config-subif)#ip add 192.168.20.254 255.255.255.0
R1(config-subif)#no shutdown
開始配置單臂路由
- 配置 s4 VLAN and Trunk
PC 端口的 vlan
s4(config)#vlan 10
s4(config)#int e0/0
s4(config-if)#switchport mode access
s4(config-if)#switchport access vlan 10
配置 trunk
s4(config)#interface e0/1
s4(config-if)#switchport trunk encapsulation dot1q
s4(config-if)#switchport mode trunk
s4(config-if)#switchport nonegotiate
看結(jié)果
s4#show vlan br
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Et0/2, Et0/3
10 vlan10 active Et0/0
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
- 配置 s5 VLAN and Trunk
s5 有 4 個(gè)接口:
先配兩個(gè) trunk
s4(config)#interface e0/0
s4(config-if)#switchport trunk encapsulation dot1q
s4(config-if)#switchport mode trunk
s4(config-if)#switchport nonegotiate
s4(config)#interface e0/3
s4(config-if)#switchport trunk encapsulation dot1q
s4(config-if)#switchport mode trunk
s4(config-if)#switchport nonegotiate
再配兩個(gè) vlan
s4(config)#vlan 10
s4(config)#int e0/2
s4(config-if)#switchport mode access
s4(config-if)#switchport access vlan 10
s4(config)#vlan 20
s4(config)#int e0/1
s4(config-if)#switchport mode access
s4(config-if)#switchport access vlan 20
看結(jié)果
Switch#show vlan brief
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active
10 VLAN0010 active Et0/2
20 VLAN0020 active Et0/1
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup
最后 pc1 ping 通 pc2 和 pc3
VPCS> ping 192.168.10.2
84 bytes from 192.168.10.2 icmp_seq=1 ttl=64 time=2.875 ms
84 bytes from 192.168.10.2 icmp_seq=2 ttl=64 time=2.331 ms
84 bytes from 192.168.10.2 icmp_seq=3 ttl=64 time=2.510 ms
84 bytes from 192.168.10.2 icmp_seq=4 ttl=64 time=2.869 ms
84 bytes from 192.168.10.2 icmp_seq=5 ttl=64 time=2.041 ms
VPCS> ping 192.168.20.1
84 bytes from 192.168.20.1 icmp_seq=1 ttl=63 time=7.648 ms
84 bytes from 192.168.20.1 icmp_seq=2 ttl=63 time=4.272 ms
84 bytes from 192.168.20.1 icmp_seq=3 ttl=63 time=3.720 ms
84 bytes from 192.168.20.1 icmp_seq=4 ttl=63 time=4.064 ms
84 bytes from 192.168.20.1 icmp_seq=5 ttl=63 time=3.524 ms
單臂路由配置結(jié)束状蜗!
完結(jié)撒花需五!