CCNA实验四:VLAN VTP VLAN间路由实验
来源:互联网 发布:数据挖掘实战微盘 编辑:程序博客网 时间:2024/05/02 01:21
实验拓扑:
一、配置VTP协议
VTP(VLAN Trunking Protocol):是VLAN中继协议,也被称为虚拟局域网干道协议。
它是思科私有协议。
在所有的交换机上配置VTP,域名为ccna,设置VTP的Sever和Client。
VTP Server:
Switch>en
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname Server
Server(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
Server(config)#vtp mode server
Device mode already VTP SERVER.
Server(config)#vtp version 2
Server(config)#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Client1:
Switch>en
Switch#conf t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname Client1
Client1(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
Client1(config)#vtp mode client
Setting device to VTP CLIENT mode.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Client2:
Switch>en
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#hostname Client2
Client2(config)#vtp domain ccna
Changing VTP domain name from NULL to ccna
Client2(config)#vtp mode client
Setting 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/1
Server(config-if)#swit
Server(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-2
Client1(config-if-range)#swi
Client1(config-if-range)#switchport mode trunk
Client1(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/2
Client2(config-if)#sw
Client2(config-if)#switchport mode trunk
Client2(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 user
documentation for configuring VTP/VLAN in config mode.
Server(vlan)#vlan 10
VLAN 10 added:
Name: VLAN0010
Server(vlan)#no vlan 10
Deleting VLAN 10...
Server(vlan)#vlan 10 name vlan10-technology
VLAN 10 added:
Name: vlan10-technology
Server(vlan)#vlan 20 name vlan20-HR
VLAN 20 added:
Name: vlan20-HR
Server(vlan)#vlan 30 name vlan30-market
VLAN 30 added:
Name: vlan30-market
Server(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/2
10 vlan10-technology active
20 vlan20-HR active
30 vlan30-market 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
10 enet 100010 1500 - - - - - 0 0
20 enet 100020 1500 - - - - - 0 0
30 enet 100030 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
------- --------- ----------------- ------------------------------------------
Server#
这里可以看到vlan 10、20、30已经划分成功,但还没有加入接口,下面再将接口划分到vlan下。~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
在客户机上查看vtp信息:
Client1#show vtp status
VTP Version : 2
Configuration Revision : 6
Maximum VLANs supported locally : 255
Number of existing VLANs : 8
VTP Operating Mode : Client 客户模式
VTP Domain Name : ccna 域名
VTP Pruning Mode : Disabled 未开启裁剪
VTP V2 Mode : Enabled 开启了版本2
VTP Traps Generation : Disabled 未启用自陷信息
MD5 digest : 0x82 0x51 0x1A 0x92 0xE4 0xA1 0x8E 0xFD
Configuration last modified by 192.168.1.253 at 3-1-93 01:15:46
Client1#
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
将接口划分到vlan中
- 将server中的f0/3-10接口划分到vlan 10中
Server(config)#int range f0/3-10
Server(config-if-range)#swi
Server(config-if-range)#switchport mode access
Server(config-if-range)#sw
Server(config-if-range)#switchport access vlan 10
Server(config-if-range)#
- 将client中的f0/10-20接口划分到vlan 20中
Client1(config)#int range f0/10-20
Client1(config-if-range)#sw
Client1(config-if-range)#switchport mode access
Client1(config-if-range)#sw
Client1(config-if-range)#switchport access vlan 20
Client1(config-if-range)#exit
- 将client2中的f0/5-15接口划分到vlan 10中
Client2(config)#int range f0/5-15
Client2(config-if-range)#sw
Client2(config-if-range)#switchport mode access
Client2(config-if-range)#sw
Client2(config-if-range)#switchport access vlan 10
Client2(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/0
R1(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 up
R1(config-if)#int f0/0.1
R1(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)#encaps
R1(config-subif)#encapsulation dot1q 10
R1(config-subif)#ip add 192.168.1.1 255.255.255.0
R1(config-subif)#exi
R1(config)#
- 将f0/0.2接口指定为802.1q协议,vlan 20
R1(config)#int f0/0
R1(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 up
R1(config-subif)#
R1(config-subif)#enca
R1(config-subif)#encapsulation dot1q 20
R1(config-subif)#ip add 192.168.20.1 255.255.255.0
R1(config-subif)#exi
R1(config)#
- 设置Server交换机与路由器相连接口为Trunk模式
Server(config)#int f0/24
Server(config-if)#sw
Server(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=128
Reply from 192.168.1.30: bytes=32 time=19ms TTL=128
Reply from 192.168.1.30: bytes=32 time=18ms TTL=128
Reply 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划分设置成功!!
本文出自 “Keep it simple.” 博客,请务必保留此出处http://shenghao.blog.51cto.com/5890026/1175074
- CCNA实验四:VLAN VTP VLAN间路由实验
- CCNA实验八 使用VTP管理vlan
- CCNA实验九 通过三层交换机实现vlan间路由
- CCNA实验—VLAN
- CCNA实验十 通过路由器实现vlan间路由(单臂路由)
- 实验四 primary Vlan 和secondary Vlan
- CCNA实验七 跨交换机间的vlan
- CCNA实验六 创建和应用VLAN
- CCNA实验1 交换与vlan
- VLAN实验
- vlan实验
- CCNA实验3 VTP
- 实验 21 VLAN 间的路由—单臂路由
- VLAN\VTP\HSRP综合实验(真机测试通过)
- 实验四:交换机VLAN划分实验
- 实验六 利用三层交换机实现VLAN间路由
- VLAN间路由,pppoe,easy ip ,acl综合实验
- 实验六 利用三层交换机实现VLAN间路由
- NYOJ - 欧拉函数求和
- Java实现lagrange 插值法
- jQuery实现全选反选功能
- 中国互联网发展趋势及特点
- 使用R语言画圆弧条形图
- CCNA实验四:VLAN VTP VLAN间路由实验
- 我对锤子ROM 功能的看法——功能篇
- poj1016
- Android三种实现自定义ProgressBar的方式介绍
- 享元模式
- Rescue
- Qt编写串口通信程序全程图文讲解
- Vista/Win7 使用Vista Loader激活后的 Windows/Linux双启动解决方案
- fatal:remote error:You can't push to git://github.com/username/*.git