文档库 最新最全的文档下载
当前位置:文档库 › 实验2:交换机配置

实验2:交换机配置

实验2:交换机配置
实验2:交换机配置

实验二: 交换机相关技术

1.

本实验主要用来练习交换机上VLAN 、VTP 配置,交换机间TRUNK 配置,

验证VLAN 、VTP 、TRUNK 的工作原理。实验的拓扑图如图所示:

2. 实验原理

(1)交换机配置模式

交换机配置模式是用于不同级别的命令对交换机进行配置,同时提供了一定的安全性、规范性。对于几种配置模式的学习,需要不断的使用才可掌握。几种配置模式如下:

普通用户模式:开机直接进入普通用户模式,在该模式下我们只能查询交换机的一些基础信息,如版本号(show version)。提示信息:>

特权用户模式:在普通用户模式下输入enable 命令即可进入特权用户模式,在该模式

下我们可以查看交换机的配置信息和调试信息等等。提示信息:#

全局配置模式:在特权用户模式下输入configure terminal 命令即可进入全局配置模式,在该模式下主要完成全局参数的配置。提示信息:(config)#

接口配置模式:在全局配置模式下输入interface interface-list 即可进入接口配置模式,

在该模式下主要完成接口参数的配置。提示信息:(config-if)#

注意:在使用命令行进行配置的时候,我们不可能完全记住所有的命令格式和参数,思科交换机提供了强有力的帮助功能,在任何模式下均可以使用“?”来帮助我们完成配置。使用“?”可以查询任何模式下可以使用的命令,或者某命令后面可以输入

的参数,或者以某字母开始的命令。如在全局配置模式下输入“?”或“show ?”或“s?”。(2)交换机工作模式切换

1.按照第二次实验的方法进入Boson NetSim的交换机配置界面,进入用户模式。请注意现在交换机上的显示符号。显示如下:>

2.使用help命令,使用help命令(?)查看在用户模式下交换机所支持的命令。

3.进入特权模式,输入(enable)命令,进入特权模式。如果交换机有密码保护那么此时需要输入确认密码。注意现在所显示符号和用户模式时的差别。显示如下:#

4.使用help命令,使用help命令(?)查看在特权模式下交换机所支持的命令。注意和用户模式下的区别。

5.进入全局配置模式,输入命令(configure terminal 或conf t)进入全局配置模式。注意现在所显示符号以及命令提示。显示如下:(config) #

6.使用help命令,使用help命令(?)查看在全局配置模式下交换机所支持的配置命令。

7.退出全局配置模式,使用快捷键(Ctrl+Z)退出全局配置模式,进入特权模式。也可以使用命令(exit)退出全局配置模式。

8.退出特权模式,使用命令(disable)从特权模式会到用户模式。

9.退出交换机,使用命令(exit)退出交换机。这个命令可以用来从特权模式中退出交换机。

注意:自己实验体会end命令的作用。体会各种模式的切换方法。

(3)交换机配置基本命令

1.模式间的转换

Switch> //用户执行模式提示符

Switch>enable //进入特权模式

Switch# //特权模式提示符

Switch# configure terminal //进入全局配置模式

Switch(config)# //全局配置模式提示符

Switch(config)#line console 0 //进入控制线路模式

Switch(config-line)# //控制线路模式

Switch(config-line)#exit //回到上一级模式

Switch(config)# //全局配置模式提示符

Switch(config)#interface f0/1 //进入接口配置模式,(f0/1用于识别交换机的端口,

//其表示形式为端口类型模块/端口)Switch(config-if)# //接口配置模式提示符

Switch(config-if)# ctrl+z //直接返回到特权模式

Switch#//特权模式提示符

2.配置交换机的名称

Switch> //用户执行模式提示符

Switch>enable //进入特权模式

Switch# //特权模式提示符

Switch#configure terminal //进入全局配置模式

Switch(config)# //全局配置模式提示符

Switch(config)#hostname lab_a //配置交换机的名称为lab_a

3.配置交换机的enable口令

Lab_a> //用户执行模式提示符

Lab_a>enable //进入特权模式

Lab_a# //特权模式提示符

Lab_a# configure terminal //进入全局配置模式

Lab_a(config)# //全局配置模式提示符

Lab_a(config)#enable password net //设置enable password 为net

Lab_a(config)#enable secret student //设置enable secret为student

Lab_a(config)#exit //回到上一级模式

Lab_a# //特权模式提示符

4.配置交换机的控制终端密码

Lab_a> //用户执行模式提示符

Lab_a>enable //进入特权模式

Lab_a# //特权模式提示符

Lab_a# configure terminal //进入全局配置模式

Lab_a(config)# //全局配置模式提示符

Lab_a(config)#line console 0 //进入line子模式

Lab_a(config-line)#password network //设置控制终端登录密码为network

Lab_a(config-line)#ctrl+Z //返回到特权模式

Lab_a# //特权模式提示符

5.配置交换机的虚拟终端(vty)密码

Lab_a> //用户执行模式提示符

Lab_a>enable //进入特权模式

Lab_a# //特权模式提示符

Lab_a# configure terminal //进入全局配置模式

Lab_a(config)# //全局配置模式提示符

Lab_a(config)#line vty 0 15 //配置VTY0到VTY15的密码

Lab_a(config-line)#password network //设置控制终端密码为network

Lab_a(config-line)#exit //回到上一级模式

Lab_a(config)# //全局配置模式提示符

3. 实验步骤

(1)绘制实验拓扑图

首先,利用Boson Network Designer 绘制实验网络拓扑图,在绘图过程中请注意,按照“够用为度”的原则,这里我们可以选择2950-12作为路由器型号。同时,将两台交换机的快速以太网接口fastethernet 0/12 连接起来。将Host1 接入交换机SW1的fe 0/1 ,Host2 接入交换机SW1的fe 0/2 ,Host3 接入交换机SW2的fe 0/1 ,Host4 接入交换机SW2的fe 0/2。

(2)配置交换机基本参数

在绘制完实验拓扑图后,可以将其保存并装入Boson NetSim中开始实验配置。

通过Boson NetSim中的工具栏按钮“eSwitches”选择“SW1”并按照下面的过程进行交换机基本参数的配置:

Switch>enable

Switch#conf t

Switch(config)#host SW1

SW1(config)#ena se c1

SW1(config)#line vty 0 15

SW1(config-line)#pass c2

SW1(config-line)#int fe 0/1

SW1(config-if)#switchport mode access

SW1(config-if)#int fe 0/2

SW1(config-if)#switchport mode access

SW1(config-if)#int vlan 1

SW1(config-if)#ip add 192.168.0.1 255.255.255.0

SW1(config-if)#no shut

SW1(config-if)#end

SW1#copy run start

通过Boson NetSim中的工具栏按钮“eSwitches”选择“SW2”并按照下面的过程进行交换机基本参数的配置:

Switch>enable

Switch#conf t

Switch(config)#host SW2

SW2(config)#ena se c1

SW2(config)#line vty 0 15

SW2(config-line)#pass c2

SW2(config-line)#int fe 0/1

SW2(config-if)#switchport mode access

SW2(config-if)#int fe 0/2

SW2(config-if)#switchport mode access

SW2(config-if)#int vlan 1

SW2(config-if)#ip add 192.168.0.2 255.255.255.0

SW2(config-if)#no shut

SW2(config-if)#end

SW2#copy run start

(3)配置、测试PC 机基本参数

通过Boson NetSim中的工具栏按钮“eStations ”选择“Host 1 ”并按照下面的步骤配置Host 1 的相关参数:

键入“回车键”继续。

在Host 1 的命令提示符下键入ipconfig /ip 192.168.0.11 255.255.255.0为Host 1 设置IP 地址、子网掩码。

在Host 2 的命令提示符下键入ipconfig /ip 192.168.0.22 255.255.255.0为Host 2 设置IP 地址、子网掩码。

在Host 3 的命令提示符下键入ipconfig /ip 192.168.0.33 255.255.255.0为Host 3 设置IP 地址、子网掩码。

在Host 4 的命令提示符下键入ipconfig /ip 192.168.0.44 255.255.255.0为Host 4 设置IP 地址、子网掩码。

在Host 1 的命令提示符下键入ping 192.168.0.1 测试到交换机SW1 的管理IP的连通性。

在Host 1 的命令提示符下键入ping 192.168.0.2 测试到交换机SW2 的管理IP的连通性。

在Host 1 的命令提示符下键入ping 192.168.0.22测试到PC机Host 2 的连通性。

在Host 1 的命令提示符下键入ping 192.168.0.33测试到PC机Host 3 的连通性。

在Host 1 的命令提示符下键入ping 192.168.0.44测试到PC机Host 4 的连通性。(4)配置、测试TRUNK 、VLAN 、VTP

选择交换机SW1并配置相关的TRUNK 信息,如下所示:

SW1#conf t

SW1(config)#int fe 0/12

SW1(config-if)#switchport mode trunk

SW1(config-if)#end

SW1#copy run start

选择交换机SW2并配置相关的TRUNK 信息,如下所示:

SW2#conf t

SW2(config)#int fe 0/12

SW2(config-if)#switchport mode trunk

SW2(config-if)#end

SW2#copy run start

选择交换机SW1并配置、测试VTP 信息,如下所示:

SW1#conf t

SW1(config)#vtp mode server

SW1(config)#vtp domain chinaitlab

SW1(config)#end

SW1#copy run start

SW1#show vtp status

选择交换机SW2并配置、测试VTP 信息,如下所示:

SW2#conf t

SW2(config)#vtp mode client

SW2(config)#vtp domain chinaitlab

SW2(config)#end

SW2#copy run start

SW2#show vtp status

选择交换机SW1并配置、测试VLAN 信息,如下所示:

SW1#vlan database

SW1(vlan)#vlan 10 name test10

SW1(vlan)#vlan 20 name test20

SW1(vlan)#int fe 0/1

SW1(config-if)#switchport access vlan 10

SW1(config-if)#int fe 0/2

SW1(config-if)#switchport access vlan 20

SW1#copy run start

SW1#show vlan

选择交换机SW2并测试VLAN 信息,如下所示:

SW2#show vlan

选择PC机并测试相关的VLAN 、VTP 配置,如下所示:

在Host 1 的命令提示符下键入ipconfig /ip 192.168.1.1为Host 1 重新设置IP地址、子

网掩码。

在Host 2 的命令提示符下键入ipconfig /ip 192.168.1.2 255.255.255.0为Host 2 重新设置IP地址、子网掩码。

在Host 3 的命令提示符下键入ipconfig /ip 192.168.1.3 255.255.255.0为Host 3 重新设置IP地址、子网掩码。

在Host 4 的命令提示符下键入ipconfig /ip 192.168.1.4 255.255.255.0为Host 4 重新设置IP地址、子网掩码。

在Host 1 的命令提示符下键入ping 192.168.0.1 测试到交换机SW1 的管理IP的连通性。

在Host 1 的命令提示符下键入ping 192.168.0.2 测试到交换机SW2 的管理IP的连通性。

在Host 1 的命令提示符下键入ping 192.168.1.2 测试到PC机Host 2 的连通性。

在Host 1 的命令提示符下键入ping 192.168.1.3 测试到PC机Host 3 的连通性。

在Host 1 的命令提示符下键入ping 192.168.1.4 测试到PC机Host 4 的连通性。

在Host 2 的命令提示符下键入ping 192.168.1.4 测试到PC机Host 4 的连通性。

在Host 3 的命令提示符下键入ping 192.168.1.2 测试到PC机Host 2 的连通性。

在Host 3 的命令提示符下键入ping 192.168.1.4 测试到PC机Host 4 的连通性。

4. 实验报告要求

(1)正确使用常用交换机配置命令。

(2)记录实验中所使用的命令格式和执行结果

(3)按要求完成实验报告。

实验过程及结果:

(交换机1)配置:

C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX, RELEASE SOFTWARE (fc4) Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.

2960-24TT starting...

Base ethernet MAC Address: 00D0.BA66.89BB

Xmodem file system is available.

Initializing Flash...

flashfs[0]: 1 files, 0 directories

flashfs[0]: 0 orphaned files, 0 orphaned directories

flashfs[0]: Total bytes: 64016384

flashfs[0]: Bytes used: 4414921

flashfs[0]: Bytes available: 59601463

flashfs[0]: flashfs fsck took 1 seconds.

...done Initializing Flash.

Boot Sector Filesystem (bs:) installed, fsid: 3

Parameter Block Filesystem (pb:) installed, fsid: 4

Loading "flash:/c2960-lanbase-mz.122-25.FX.bin"...

########################################################################## [OK] Restricted Rights Legend

Use, duplication, or disclosure by the Government is

subject to restrictions as set forth in subparagraph

(c) of the Commercial Computer Software - Restricted

Rights clause at FAR sec. 52.227-19 and subparagraph

(c) (1) (ii) of the Rights in Technical Data and Computer

Software clause at DFARS sec. 252.227-7013.

cisco Systems, Inc.

170 West Tasman Drive

San Jose, California 95134-1706

Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1)

Copyright (c) 1986-2005 by Cisco Systems, Inc.

Compiled Wed 12-Oct-05 22:05 by pt_team

Image text-base: 0x80008098, data-base: 0x814129C4

Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.

24 FastEthernet/IEEE 802.3 interface(s)

2 Gigabit Ethernet/IEEE 802.

3 interface(s)

63488K bytes of flash-simulated non-volatile configuration memory.

Base ethernet MAC Address : 00D0.BA66.89BB

Motherboard assembly number : 73-9832-06

Power supply part number : 341-0097-02

Motherboard serial number : FOC103248MJ

Power supply serial number : DCA102133JA

Model revision number : B0

Motherboard revision number : C0

Model number : WS-C2960-24TT

System serial number : FOC1033Z1EY

Top Assembly Part Number : 800-26671-02

Top Assembly Revision Number : B0

Version ID : V02

CLEI Code Number : COM3K00BRA

Hardware Board Revision Number : 0x01

Switch Ports Model SW Version SW Image

------ ----- ----- ---------- ----------

* 1 26 WS-C2960-24TT 12.2 C2960-LANBASE-M

Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1)

Copyright (c) 1986-2005 by Cisco Systems, Inc.

Compiled Wed 12-Oct-05 22:05 by pt_team

Press RETURN to get started!

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINK-5-CHANGED: Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINK-5-CHANGED: Interface FastEthernet0/3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

%LINK-5-CHANGED: Interface GigabitEthernet1/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/1, changed state to up

Switch>

Switch>

Switch>

Switch>enable

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.

Switch(vlan)#vlan 1 name engineer

A default VLAN may not have its name changed.

Switch(vlan)#vlan 2 name account

VLAN 2 added:

Name: account

Switch(vlan)#vlan 3 name manager

VLAN 3 added:

Name: manager

Switch(vlan)#exit

APPL Y completed.

Exiting....

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#

Switch(config)#TimesNewRomanPSMT;mso-fareast-font-family:;mso-bidi-font-family:"Times New Roman";

^

% Invalid input detected at '^' marker.

Switch(config)#mso-ansi-language:EN-US;mso-fareast-language:ZH-CN;mso-bidi-language:AR-SA'>interface

^

% Invalid input detected at '^' marker.

Switch(config)#FastEthernet 0/2

^

% Invalid input detected at '^' marker.

Switch(config)#

Switch(config)#

Switch(config)#interface f0/2

Switch(config-if)#switchport access vlan 2

Switch(config-if)#interface f0/3

Switch(config-if)#switchport access vlan 3

Switch(config-if)#int g1/1

Switch(config-if)#switchport mode trunk

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/1, changed state to up

Switch(config-if)#

(交换机2)配置:

C2960 Boot Loader (C2960-HBOOT-M) Version 12.2(25r)FX, RELEASE SOFTWARE (fc4) Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.

2960-24TT starting...

Base ethernet MAC Address: 00D0.BA66.89BB

Xmodem file system is available.

Initializing Flash...

flashfs[0]: 1 files, 0 directories

flashfs[0]: 0 orphaned files, 0 orphaned directories

flashfs[0]: Total bytes: 64016384

flashfs[0]: Bytes used: 4414921

flashfs[0]: Bytes available: 59601463

flashfs[0]: flashfs fsck took 1 seconds.

...done Initializing Flash.

Boot Sector Filesystem (bs:) installed, fsid: 3

Parameter Block Filesystem (pb:) installed, fsid: 4

Loading "flash:/c2960-lanbase-mz.122-25.FX.bin"...

########################################################################## [OK] Restricted Rights Legend

Use, duplication, or disclosure by the Government is

subject to restrictions as set forth in subparagraph

(c) of the Commercial Computer Software - Restricted

Rights clause at FAR sec. 52.227-19 and subparagraph

(c) (1) (ii) of the Rights in Technical Data and Computer

Software clause at DFARS sec. 252.227-7013.

cisco Systems, Inc.

170 West Tasman Drive

San Jose, California 95134-1706

Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1)

Copyright (c) 1986-2005 by Cisco Systems, Inc.

Compiled Wed 12-Oct-05 22:05 by pt_team

Image text-base: 0x80008098, data-base: 0x814129C4

Cisco WS-C2960-24TT (RC32300) processor (revision C0) with 21039K bytes of memory.

24 FastEthernet/IEEE 802.3 interface(s)

2 Gigabit Ethernet/IEEE 802.

3 interface(s)

63488K bytes of flash-simulated non-volatile configuration memory.

Base ethernet MAC Address : 00D0.BA66.89BB

Motherboard assembly number : 73-9832-06

Power supply part number : 341-0097-02

Motherboard serial number : FOC103248MJ

Power supply serial number : DCA102133JA

Model revision number : B0

Motherboard revision number : C0

Model number : WS-C2960-24TT

System serial number : FOC1033Z1EY

Top Assembly Part Number : 800-26671-02

Top Assembly Revision Number : B0

Version ID : V02

CLEI Code Number : COM3K00BRA

Hardware Board Revision Number : 0x01

Switch Ports Model SW Version SW Image

------ ----- ----- ---------- ----------

* 1 26 WS-C2960-24TT 12.2 C2960-LANBASE-M

Cisco IOS Software, C2960 Software (C2960-LANBASE-M), Version 12.2(25)FX, RELEASE SOFTWARE (fc1)

Copyright (c) 1986-2005 by Cisco Systems, Inc.

Compiled Wed 12-Oct-05 22:05 by pt_team

Press RETURN to get started!

%LINK-5-CHANGED: Interface FastEthernet0/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/1, changed state to up

%LINK-5-CHANGED: Interface FastEthernet0/2, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/2, changed state to up

%LINK-5-CHANGED: Interface FastEthernet0/3, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/3, changed state to up

%LINK-5-CHANGED: Interface GigabitEthernet1/1, changed state to up

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/1, changed state to up

Switch>

Switch>

Switch>

Switch>enable

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.

Switch(vlan)#vlan 1 name engineer

A default VLAN may not have its name changed.

Switch(vlan)#vlan 2 name account

VLAN 2 added:

Name: account

Switch(vlan)#vlan 3 name manager

VLAN 3 added:

Name: manager

Switch(vlan)#exit

APPL Y completed.

Exiting....

Switch#conf t

Enter configuration commands, one per line. End with CNTL/Z.

Switch(config)#

Switch(config)#TimesNewRomanPSMT;mso-fareast-font-family:;mso-bidi-font-family:"Times New Roman";

^

% Invalid input detected at '^' marker.

Switch(config)#mso-ansi-language:EN-US;mso-fareast-language:ZH-CN;mso-bidi-language:AR-SA'>interface

^

% Invalid input detected at '^' marker.

Switch(config)#FastEthernet 0/2

^

% Invalid input detected at '^' marker.

Switch(config)#

Switch(config)#

Switch(config)#interface f0/2

Switch(config-if)#switchport access vlan 2

Switch(config-if)#interface f0/3

Switch(config-if)#switchport access vlan 3

Switch(config-if)#int g1/1

Switch(config-if)#switchport mode trunk

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/1, changed state to down

%LINEPROTO-5-UPDOWN: Line protocol on Interface GigabitEthernet1/1, changed state to up

Switch(config-if)#

相关文档
相关文档 最新文档