# 拓扑图
![](https://box.kancloud.cn/662d37f9195d944cd75448b10ac4c627_971x478.png)
# 基础配置
## MS1:
~~~
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname MS1
MS1(config)#no logging console //禁止 console 口的日志,以免干扰你在控制台的操作
MS1(config)#interface fastEthernet 0/1
MS1(config-if)#switchport trunk encapsulation dot1q
MS1(config-if)#switchport mode trunk
MS1(config)#interface fastEthernet 0/2
MS1(config-if)#switchport trunk encapsulation dot1q
MS1(config-if)#switchport mode trunk
MS1(config)#vtp mode server
Device mode already VTP SERVER.
MS1(config)#vtp domain test
Changing VTP domain name from NULL to test
MS1(config)#vtp password 123
Setting device VLAN database password to 123
~~~
## SW1:
~~~
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW1
SW1(config)#no logging console
SW1(config)#interface fastEthernet 0/2
SW1(config-if)#switchport mode trunk
SW1(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW1(config)#vtp domain test
Changing VTP domain name from NULL to test
SW1(config)#vtp password 123
Setting device VLAN database password to 123
~~~
## SW2:
~~~
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW2
SW2(config)#no logging console
SW2(config)#interface fastEthernet 0/1
SW2(config-if)#switchport mode trunk
SW2(config)#interface fastEthernet 0/2
SW2(config-if)#switchport mode trunk
SW2(config)#vtp mode transparent
Setting device to VTP TRANSPARENT mode.
SW2(config)#vtp domain test
Changing VTP domain name from NULL to test
SW2(config)#vtp password 123
Setting device VLAN database password to 123
~~~
## SW3:
~~~
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW3
SW3(config)#no logging console
SW3(config)#interface fastEthernet 0/1
SW3(config-if)#switchport mode trunk
SW3(config)#vtp mode client
Setting device to VTP CLIENT mode.
SW3(config)#vtp domain test
Changing VTP domain name from NULL to test
SW3(config)#vtp password 123
Setting device VLAN database password to 123
~~~
## SW4:
~~~
Switch>enable
Switch#configure terminal
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname SW4
SW4(config)#no logging console
SW4(config)#interface fastEthernet 0/1
SW4(config-if)#switchport mode trunk
SW4(config)#interface fastEthernet 0/2
SW4(config-if)#switchport mode trunk
SW4(config)#vtp mode transparent
Setting device to VTP TRANSPARENT mode.
SW4(config)#vtp domain test1
Changing VTP domain name from NULL to test1
SW4(config)#vtp password 456
Setting device VLAN database password to 456
~~~
# 实验测试
* 在 MS1(server)**创建**,**删除**和**命名** vlan 的操作会同步到 SW1(client)和 SW3(client), 但不会同步到 SW2(transparent)和 SW4(transparent)
### 注意
* vtp 仅同步创建,删除和命名 vlan,不会同步配置的 ip 地址
* vtp transparent 模式的域名可以与 server 模式域名不同,但 client 模式域名必须与 server 模式域名及密码保持一致,否则不会同步 vlan 信息。