relha 发表于 2013-4-10 08:50:52

CCNA实验五:VLAN VTP VLAN间路由实验

本帖最后由 relha 于 2013-4-10 08:51 编辑

实验拓扑:


一、配置VTP协议VTP(VLAN Trunking Protocol):是VLAN中继协议,也被称为虚拟局域网干道协议。它是思科私有协议。
在所有的交换机上配置VTP,域名为ccna,设置VTP的Sever和Client。
VTP Server:
Switch>enSwitch#config tEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#hostname ServerServer(config)#vtp domain ccnaChanging VTP domain name from NULL to ccnaServer(config)#vtp mode serverDevice mode already VTP SERVER.Server(config)#vtp version 2Server(config)#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Client1:
Switch>enSwitch#conf tEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#hostname Client1Client1(config)#vtp domain ccnaChanging VTP domain name from NULL to ccnaClient1(config)#vtp mode clientSetting device to VTP CLIENT mode.~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Client2:
Switch>enSwitch#config tEnter configuration commands, one per line.End with CNTL/Z.Switch(config)#hostname Client2Client2(config)#vtp domain ccnaChanging VTP domain name from NULL to ccnaClient2(config)#vtp mode clientSetting device to VTP CLIENT mode.Client2(config)#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
二、配置中继端口
配置交换机的接口有五种模式:
[*]Switchport mode access
将接口设置为永久非中继模式,成为专用的第二层接入点。
[*]switchport mode trunk
将接口设置为永久中继模式,并可以通过协商将链路设置为Trunk模式。
[*]switchport mode dynamic auto
这种模式为自动模式,若邻接接口为Trunk和desirable 模式,可以自动协商成Trunk模式。
[*]Switchport mode dynamic desirable
这样设置接口是使接口能够尽力转换为中继模式,若两端接口都为desirable模式,则可以协商成trunk模式。现在的思科交换机所有以太网都默认设置为此模式了。
[*]Switchport nonegotiate
禁止接口生成DTP帧。仅当接口处于access和trunk模式时,才能使用此命令。~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Server:
Server(config)#int f0/1Server(config-if)#switServer(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Server(config-if)#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Client1:
Client1(config)#int range f0/1-2Client1(config-if-range)#swiClient1(config-if-range)#switchport mode trunkClient1(config-if-range)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up
Client1(config-if-range)#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Client2:
Client2(config)#int f0/2Client2(config-if)#swClient2(config-if)#switchport mode trunkClient2(config-if)#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
三、配置VLAN
配置vlan需要在VTP Server上进行,普通的client上是没有增添删改vlan的权限的。
Server:
Server#vlan database% Warning: It is recommended to configure VLAN from config mode,as VLAN database mode is being deprecated. Please consult userdocumentation for configuring VTP/VLAN in config mode.
Server(vlan)#vlan 10VLAN 10 added:    Name: VLAN0010Server(vlan)#no vlan 10Deleting VLAN 10...Server(vlan)#vlan 10 name vlan10-technologyVLAN 10 added:    Name: vlan10-technologyServer(vlan)#vlan 20 name vlan20-HRVLAN 20 added:    Name: vlan20-HRServer(vlan)#vlan 30 name vlan30-marketVLAN 30 added:    Name: vlan30-marketServer(vlan)#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Show vlan检查vlan信息
Server#show vlan
VLAN Name                           Status    Ports---- -------------------------------- --------- -------------------------------1    default                        active    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, Fa0/23, Fa0/24, Gig1/1                                                Gig1/210   vlan10-technology                active   20   vlan20-HR                        active   30   vlan30-market                  active   1002 fddi-default                     act/unsup1003 token-ring-default               act/unsup1004 fddinet-default                  act/unsup1005 trnet-default                  act/unsup
VLAN TypeSAID       MTU   Parent RingNo BridgeNo StpBrdgMode Trans1 Trans2---- ----- ---------- ----- ------ ------ -------- ---- -------- ------ ------1    enet100001   1500-      -      -      -    -      0      010   enet100010   1500-      -      -      -    -      0      020   enet100020   1500-      -      -      -    -      0      030   enet100030   1500-      -      -      -    -      0      01002 fddi101002   1500-      -      -      -    -      0      01003 tr    101003   1500-      -      -      -    -      0      01004 fdnet 101004   1500-      -      -      ieee -      0      01005 trnet 101005   1500-      -      -      ibm-      0      0
Remote SPAN VLANs------------------------------------------------------------------------------

Primary Secondary Type            Ports------- --------- ----------------- ------------------------------------------Server#
这里可以看到vlan 10、20、30已经划分成功,但还没有加入接口,下面再将接口划分到vlan下。~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
在客户机上查看vtp信息:
Client1#show vtp statusVTP Version                     : 2Configuration Revision          : 6Maximum VLANs supported locally : 255Number of existing VLANs      : 8VTP Operating Mode            : Client            客户模式VTP Domain Name               : ccna                  域名VTP Pruning Mode                : Disabled         未开启裁剪VTP V2 Mode                     :Enabled         开启了版本2VTP Traps Generation            : Disabled         未启用自陷信息MD5 digest                      : 0x82 0x51 0x1A 0x92 0xE4 0xA1 0x8E 0xFDConfiguration last modified by 192.168.1.253 at 3-1-93 01:15:46Client1#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
将接口划分到vlan中

[*]将server中的f0/3-10接口划分到vlan 10中
Server(config)#int range f0/3-10Server(config-if-range)#swiServer(config-if-range)#switchport mode accessServer(config-if-range)#swServer(config-if-range)#switchport access vlan 10Server(config-if-range)#
[*]将client中的f0/10-20接口划分到vlan 20中
Client1(config)#int range f0/10-20Client1(config-if-range)#swClient1(config-if-range)#switchport mode accessClient1(config-if-range)#swClient1(config-if-range)#switchport access vlan 20Client1(config-if-range)#exit
[*]将client2中的f0/5-15接口划分到vlan 10中
Client2(config)#int range f0/5-15Client2(config-if-range)#swClient2(config-if-range)#switchport mode accessClient2(config-if-range)#swClient2(config-if-range)#switchport access vlan 10Client2(config-if-range)#exi~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
设置PC的ip

[*]PC1
IP:192.168.1.10/24网关:192.168.1.1
[*]PC2
IP:192.168.1.20/24网关:192.168.1.1
[*]PC3
IP:192.168.20.10/24网关:192.168.20.1
[*]PC4
IP:192.168.1.30/24网关:192.168.1.1~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~设置单臂路由

[*]将f0/0.1接口指定为802.1q协议,vlan 10
R1(config)#int f0/0R1(config-if)#no shut
%LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up
R1(config-if)#no shut%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to upR1(config-if)#int f0/0.1R1(config-subif)#%LINK-5-CHANGED: Interface FastEthernet0/0.1, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.1, changed state to up
R1(config-subif)#encapsR1(config-subif)#encapsulation dot1q 10R1(config-subif)#ip add 192.168.1.1 255.255.255.0R1(config-subif)#exiR1(config)#

[*]将f0/0.2接口指定为802.1q协议,vlan 20
R1(config)#int f0/0R1(config-if)#int f0/0.2
%LINK-5-CHANGED: Interface FastEthernet0/0.2, changed state to up
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0.2, changed state to upR1(config-subif)#R1(config-subif)#encaR1(config-subif)#encapsulation dot1q 20R1(config-subif)#ip add 192.168.20.1 255.255.255.0R1(config-subif)#exiR1(config)#

[*]设置Server交换机与路由器相连接口为Trunk模式

Server(config)#int f0/24Server(config-if)#swServer(config-if)#switchport mode trunk
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to down
%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/24, changed state to up
Server(config-if)#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~测试主机的连通性
PC>ping 192.168.1.30
Pinging 192.168.1.30 with 32 bytes of data:
Reply from 192.168.1.30: bytes=32 time=56ms TTL=128Reply from 192.168.1.30: bytes=32 time=19ms TTL=128Reply from 192.168.1.30: bytes=32 time=18ms TTL=128Reply from 192.168.1.30: bytes=32 time=17ms TTL=128
Ping statistics for 192.168.1.30:    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),Approximate round trip times in milli-seconds:    Minimum = 17ms, Maximum = 56ms, Average = 27ms
PC1可以成功ping通PC4,说明vlan划分设置成功!!


dengwen3 发表于 2013-4-10 09:38:11

做爱做的事,交配交的人。

angela 发表于 2013-5-16 10:35:56

不错不错,楼主您辛苦了。。。

378 发表于 2013-5-17 09:03:01

我不在江湖,但江湖中有我的传说。

轻轻的 发表于 2013-5-18 06:40:34

不知该说些什么。。。。。。就是谢谢

q968 发表于 2013-5-19 03:38:39

帮你顶下哈!!

opo 发表于 2013-5-20 01:56:19

我本非随便的人,但如果你想随便,那我就随你的便好啦!
页: [1]
查看完整版本: CCNA实验五:VLAN VTP VLAN间路由实验