本文共 4398 字,大约阅读时间需要 14 分钟。
拓扑图:
SW1:
SW1>enableSW1#config tEnter configuration commands, one per line. End with CNTL/Z.SW1(config)#hostname SW1 SW1(config)#vlan 10SW1(config-vlan)#exitSW1(config)#vlan 20SW1(config-vlan)#exitSW1(config)#vtp mode server //配置sw1为服务器端Device mode already VTP SERVER.SW1(config)#vtp domain cisco //配置vtp 的域名为CiscoDomain name already set to cisco.SW1(config)#vtp password cisco123 //配置密码Password already set to cisco123SW1(config)#service password-encryption //明文密码加密SW1(config)#interface f0/1SW1(config-if)#switchport mode trunk //配置两交换机间链路模式为trunkSW1(config-if)#switchport trunk allowed vlan all SW1(config-if)#no shutdownSW1(config-if)#exitSW1(config)#interface f0/2SW1(config-if)#switchport mode accessSW1(config-if)#switchport access vlan 10SW1(config-if)#no shutdownSW1(config-if)#exitSW1(config)#interface f0/3SW1(config-if)#switchport mode trunk //配置路由器与交换机相连链路为trunkSW1(config-if)#switchport trunk allowed vlan all SW1(config-if)#no shutdownSW1(config-if)#exitSW1(config)#
sw2:
SW2>enableSW2#config tEnter configuration commands, one per line. End with CNTL/Z.SW2(config)#hostname SW2SW2(config)#vtp mode clientDevice mode already VTP CLIENT.SW2(config)#vtp domain cisco //配置sw2为vtp客户端模式Domain name already set to cisco.SW2(config)#vtp password cisco123 //配置密码Password already set to cisco123SW2(config)#service password-encryption //明文密码加密SW2(config)#interface f0/1SW2(config-if)#switchport mode trunkSW2(config-if)#switchport trunk allowed vlan all SW2(config-if)#no shutdown SW2(config-if)#exitSW2(config)#interface f0/2SW2(config-if)#switchport mode accessSW2(config-if)#switchport access vlan 20SW2(config-if)#no shutdownSW2(config-if)#exitSW2(config)#
SW2(config)#do show vlanVLAN Name Status Ports---- -------------------------------- --------- -------------------------------1 default active 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 Fa0/23, Fa0/24, Gig1/1, Gig1/210 VLAN0010 active 20 VLAN0020 active Fa0/21002 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 010 enet 100010 1500 - - - - - 0 020 enet 100020 1500 - - - - - 0 01002 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(config)#
由查看结果可知,SW2交换机已从SW1交换机学习到了VLAN 10和VLAN 20。
AR1:
AR1>enableAR1#config tEnter configuration commands, one per line. End with CNTL/Z.AR1(config)#hostname AR1AR1(config)#interface g0/0 //进入物理接口AR1(config-if)#no shutdown //启用该接口AR1(config-if)#interface g0/0.10 //进入子接口AR1(config-subif)#encapsulation dot1q 10 // 将子接口封装到VLAN 10中AR1(config-subif)#ip address 192.168.10.254 255.255.255.0 //配置IP地址AR1(config-subif)#no shutdown //启用子接口AR1(config-subif)#exitAR1(config)#interface g0/0.20AR1(config-subif)#encapsulation dot1q 20 //将子接口封装到VLAN 20中AR1(config-subif)#ip address 192.168.20.254 255.255.255.0AR1(config-subif)#no shutdownAR1(config-subif)#exitAR1(config)#
PC1:
192.168.10.1255.255.255.0192.168.10.254PC2:
192.168.20.1255.255.255.0192.168.20.254PC1 ping PC2
PC2 ping PC1
转载于:https://blog.51cto.com/12184141/2314326