vtp(vlan中继协议)配置

关于思科VTP(vlan中继协议)配置实验


VTP(vlan中继协议)说简单点,就是用来在二层交换机上进行vlan通信,例如3台交换机,将中间的那台交换机作为vlan server,其他两台作为vlan client,我们只需要配置server就可以达到在不同交换机上的vlan通信。

准备工作:

准备3台交换机,命名为Switch1、Switch2、Switch3;
4台电脑,分别为PC1、PC2、PC3、PC4。将Switch1作为vlan server,Switch2和Switch3作为client。

设备名 IP地址 接口
PC1 192.168.1.10 Switch2:f0/1
PC2 192.168.1.20 Switch2:f0/2
PC3 192.168.1.30 Switch3:f0/1
PC4 192.168.1.40 Switch3:f0/2

Switch2:f0/3——>Switch1:f0/1
Switch3:f0/3——>Switch1:f0/2
具体示意看图一。
图一

1、配置vlan server(Switch1):

1
Switch>en
1
2
3
4
Switch#vlan database 
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
1
2
Switch(vlan)#vtp domain abc
Changing VTP domain name from NULL to abc
1
2
Switch(vlan)#vtp server 
Device mode already VTP SERVER.
1
2
3
Switch(vlan)#exit 
APPLY completed.
Exiting....
1
2
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
1
Switch(config)#vlan 10
1
Switch(config-vlan)#vlan  20

2、配置vlan client(Switch2):

1
Switch>en
1
2
3
4
Switch#vlan database 
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
1
2
Switch(vlan)#vtp domain abc
Changing VTP domain name from NULL to abc
1
2
Switch(vlan)#vtp client 
Setting device to VTP CLIENT mode.
1
2
3
Switch(vlan)#exit
APPLY completed.
Exiting....
1
2
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
1
Switch(config)#int f0/1
1
Switch(config-if)#switchport mode access
1
Switch(config-if)#switchport access vlan 10
1
Switch(config-if)#int f0/2
1
Switch(config-if)#switchport mode access
1
Switch(config-if)#switchport access vlan 20
1
Switch(config-if)#int f0/3
1
2
3
4
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

3、配置vlan client(Switch3):

1
Switch>en
1
2
3
4
Switch#vlan database 
% Warning: It is recommended to configure VLAN from config mode,
as VLAN database mode is being deprecated. Please consult user
documentation for configuring VTP/VLAN in config mode.
1
2
Switch(vlan)#vtp domain abc
Changing VTP domain name from NULL to abc
1
2
Switch(vlan)#vtp client 
Setting device to VTP CLIENT mode.
1
2
3
Switch(vlan)#exit
APPLY completed.
Exiting....
1
2
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
1
Switch(config)#int f0/1
1
Switch(config-if)#switchport mode access
1
Switch(config-if)#switchport access vlan 10
1
Switch(config-if)#int f0/2
1
Switch(config-if)#switchport mode access
1
Switch(config-if)#switchport access vlan 20
1
Switch(config-if)#int f0/3
1
2
3
4
Switch(config-if)#switchport mode trunk
Switch(config-if)#
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up