您的位置:首页 > 编程语言 > PHP开发

交换机的Vlan /TRUNK/VTP配置

2015-12-05 22:07 1006 查看


1. Sw1 sw2 sw3上有3个VLAN,要求,交换机之前采用vtp方式完成VLAN信息同步。2. SW2必须是transparent 模式。3. 实现不同VLAN 间的通信。
基础配置,以及启用vtp ,观察SW2如果使用vtp transparent 模式,能够将SW1的VLAN信息 传递给SW3
SW1 配置:
Switch>enable
Switch#config terminal
Switch(config)#line console 0
Switch(config-line)#exec-timeout 0 0
Switch(config-line)#logging synchronous
Switch(config-line)#exit

Switch(config)#no ip domain-lookup
Switch(config)#ho SW1

SW1(config)#vtp domain cisco //启用vtp 域名为 Cisco
Changing VTP domain name from NULL to cisco
SW1(config)#vtp mode server //设置vtp的模式为server
Device mode already VTP SERVER.

SW1(config)#vlan 2 //创建VLAN 2 和 VLAN 3
SW1(config-vlan)#vlan 3
SW1(config-vlan)#exit

SW1(config)#interface range f0/23-24 //将接口手动设置为trunk
SW1(config-if-range)#switchport mode trunk
SW1(config-if-range)#no shutdown
SW1(config-if-range)#exit

SW1#sho vtp status //查看vtp的信息
VTP Version : 2
Configuration Revision : 1 //配置版本号,一般 配置版本号低的会向配置版本号高的学习VLAN 信息Maximum VLANs supported locally : 255
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : cisco //vtp 的域名
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x85 0xCF 0x1D 0x4A 0x20 0xB4 0x94 0x91
Configuration last modified by 0.0.0.0 at 3-1-93 00:29:50
Local updater ID is 0.0.0.0 (no valid interface found)
SW1#

SW1#sho vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/22, Gig1/1, Gig1/2
2 VLAN0002 active
3 VLAN0003 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
2 enet 100002 1500 - - - - - 0 0
3 enet 100003 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0

Remote SPAN VLANs
------------------------------------------------------------------------------

Primary Secondary Type Ports
------- --------- ----------------- ------------------------------------------
SW1#

SW2配置:
Switch(config)#line console 0
Switch(config-line)#exec-timeout 0 0
Switch(config-line)#logging synchronous
Switch(config-line)#exit
Switch(config)#no ip domain-lookup
Switch(config)#ho SW2

Switch(config)#interface range f0/23-24 //设置SW2连接SW1的接口为trunk
Switch(config-if-range)#switchport mode trunk
Switch(config-if-range)#no shutdown
Switch(config-if-range)#exit
SW2(config)#end

SW2#sho vtp status //观察vtp的信息,发现进行同步了
VTP Version : 2
Configuration Revision : 1
Maximum VLANs supported locally : 255
Number of existing VLANs : 7
VTP Operating Mode : Server
VTP Domain Name : cisco //vtp 域名同步过来了
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x85 0xCF 0x1D 0x4A 0x20 0xB4 0x94 0x91
Configuration last modified by 0.0.0.0 at 3-1-93 00:29:50
Local updater ID is 0.0.0.0 (no valid interface found)
SW2#

SW2#config terminal
SW2(config)#vtp mode transparent //设置SW2的vtp 为transparent 模式
Setting device to VTP TRANSPARENT mode.
SW2(config)#end

SW2(config)#interface range f0/22 //设置SW2 连接SW3的接口为trunk
SW2(config-if-range)#switchport mode trunk
SW2(config-if-range)#no shutdown
SW2(config-if-range)#end

SW2#sho vtp status //观察设置后的SW2的vtp信息
VTP Version : 2
Configuration Revision : 0
Maximum VLANs supported locally : 255
Number of existing VLANs : 7
VTP Operating Mode : Transparent //vtp模式为 transparent
VTP Domain Name : cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x66 0x9F 0xAD 0x72 0x6F 0xC1 0xAF 0x06
Configuration last modified by 0.0.0.0 at 3-1-93 00:29:50

SW2#sho vlan
VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Gig1/1, Gig1/2
2 VLAN0002 active
3 VLAN0003 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
2 enet 100002 1500 - - - - - 0 0
3 enet 100003 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0

Remote SPAN VLANs
------------------------------------------------------------------------------

Primary Secondary Type Ports
------- --------- ----------------- ------------------------------------------
SW2#

SW3 配置:
Switch>enable
Switch#config terminal
Switch(config)#line console 0
Switch(config-line)#exec-timeout 0 0
Switch(config-line)#logging synchronous
Switch(config-line)#exit

Switch(config)#no ip domain-lookup
Switch(config)#ho SW3

SW3(config)#vtp mode client //设置vtp 模式为client模式
Setting device to VTP CLIENT mode.

SW3(config)#interface f0/22 //将连接SW3的接口设置为trunk
SW3(config-if)#switchport mode trunk
SW3(config-if)#no shutdown
SW3(config-if)#end

SW3#sho vtp status //观察同步过来的vtp信息
VTP Version : 2
Configuration Revision : 1
Maximum VLANs supported locally : 255
Number of existing VLANs : 7
VTP Operating Mode : Client //目前 vtp为client 模式
VTP Domain Name : cisco //vtp域名为 Cisco
VTP Pruning Mode : Disabled
VTP V2 Mode : Disabled
VTP Traps Generation : Disabled
MD5 digest : 0x85 0xCF 0x1D 0x4A 0x20 0xB4 0x94 0x91
Configuration last modified by 0.0.0.0 at 3-1-93 00:29:50
SW3#
SW3#sho vla
SW3#sho vlan

VLAN Name Status Ports
---- -------------------------------- --------- -------------------------------
1 default active Fa0/1, Fa0/2, Fa0/3, Fa0/4
Fa0/5, Fa0/6, Fa0/7, Fa0/8
Fa0/9, Fa0/10, Fa0/11, Fa0/12
Fa0/13, Fa0/14, Fa0/15, Fa0/16
Fa0/17, Fa0/18, Fa0/19, Fa0/20
Fa0/21, Fa0/23, Fa0/24, Gig1/1
Gig1/2
2 VLAN0002 active
3 VLAN0003 active
1002 fddi-default act/unsup
1003 token-ring-default act/unsup
1004 fddinet-default act/unsup
1005 trnet-default act/unsup

VLAN Type SAID MTU Parent RingNo BridgeNo Stp BrdgMode Trans1 Trans2
---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------
1 enet 100001 1500 - - - - - 0 0
2 enet 100002 1500 - - - - - 0 0
3 enet 100003 1500 - - - - - 0 0
1002 fddi 101002 1500 - - - - - 0 0
1003 tr 101003 1500 - - - - - 0 0
1004 fdnet 101004 1500 - - - ieee - 0 0
1005 trnet 101005 1500 - - - ibm - 0 0

Remote SPAN VLANs
------------------------------------------------------------------------------

Primary Secondary Type Ports
------- --------- ----------------- ------------------------------------------
SW3#

由此可知,即使SW2为transparent 模式,也会将SW1的vtp 信息 传递给SW3的。

实现不同VLAN间的路由。

SW1配置:
SW1(config)#interface f0/1
SW1(config-if)#switchport mode access //将接口设置为access 接口,用于接入PC
SW1(config-if)#switchport access vlan 1 //将接口划入VLAN 1中,用于继而,将PC1接入到VLAN 1中SW1(config-if)#no shutdown
SW1(config-if)#exit

SW1(config)#interface f0/2
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 2
SW1(config-if)#no shutdown
SW1(config-if)#exit

SW1(config)#interface f0/4
SW1(config-if)#switchport mode access
SW1(config-if)#switchport access vlan 3
SW1(config-if)#no shutdown
SW1(config-if)#exit

SW3配置:
SW3(config)#interface f0/1
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 1
SW3(config-if)#no shutdown
SW3(config-if)#exit

SW3(config)#interface f0/2
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 2
SW3(config-if)#no shutdown
SW3(config-if)#exit

SW3(config)#interface f0/3
SW3(config-if)#switchport mode access
SW3(config-if)#switchport access vlan 3
SW3(config-if)#no shutdown
SW3(config-if)#exit
SW3(config)#

接下来配置路由器,实现VLAN间的路由。

Router2 配置:
Router#config ter
Router(config)#line console 0
Router(config-line)#exec-timeout 0 0
Router(config-line)#logging synchronous
Router(config-line)#exit
Router(config)#no ip domain-lookup
Router(config)#ho R1

R1(config)#interface f0/0
R1(config-if)#no shutdown //先打开主接口
R1(config-if)#exit

R1(config)#interface f0/0.1 //启用子接口,让子接口1 作为VLAN 1的网关
R1(config-subif)#encapsulation dot1Q 1 //将子接口封装成为 dot1q 成为trunk ,识trunk 发送过来的trunk(多个VLAN的) 流量R1(config-subif)#ip address 10.1.1.254 255.255.255.0
R1(config-subif)#no shutdown
R1(config-subif)#exit

R1(config)#interface f0/0.2 //启用子接口2,作为VLAN 2 的网关
R1(config-subif)#encapsulation dot1Q 2
R1(config-subif)#ip address 20.1.1.254 255.255.255.0
R1(config-subif)#no shutdown
R1(config-subif)#exit

R1(config)#interface f0/0.3
R1(config-subif)#encapsulation dot1Q 3
R1(config-subif)#ip address 30.1.1.254 255.255.255.0
R1(config-subif)#no shutdown
R1(config-subif)#exit

SW1 配置:
将SW1 连接路由器的接口设置为trunk
SW1(config)#interface f0/3
SW1(config-if)#switchport mode trunk
SW1(config-if)#no shutdown
SW1(config-if)#end

进行pin 测试:
PC1 配置:




PC2 配置:



PC3 配置:




PC4 配置:




PC5 配置:




PC6 配置:




PC1 ping PC6




成功实现VLAN间的通信
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  VLAN TRUNK VTP 单臂路由