交换机的配置模式有许多,主要包括用户配置模式、特权模式、全局配置模式、端口配置模式和VLAN配置模式等。熟练进行各种配置模式的进入与切换,了解各种模式下的配置命令,将为以后的学习打下良好的基础。
学习情境
学习之前需要先熟悉交换机的配置模式及基本配置命令。
情境分析
在工作区添加一台Cisco Catalyst 2960交换机,交换机的console端口与PC机的COM1接口互连,使用交换机出厂随机配置的专用控制线连接,此时交换机为出厂配置,使用交换机管理的“命令行”界面进行操作,练习在交换机的多种配置模式下切换。
所需设备:
(1)Cisco Catalyst 2960交换机1台。
(2)带超级终端应用程序的PC机一台
(3)交换机的console配置线1条。
任务拓扑,如图2-1-1所示。
图2-1-1 交换机的基本配置
步骤实现
步骤1:按照如图2-1-1所示,连接网络拓扑结构图。
步骤2:单击PC机,弹出窗口中选择”Desktop”面板,出现如图2-1-2所示画面,选择第一排第三项,Terminal(超级终端),单击打开。
图2-1-2 PC机桌面应用程序
步骤3:调整超级终端参数,如图2-1-3所示,点击确定。
图2-1-3 超级终端参数设置
步骤,4:进入交换机配置页面,等待交换机装载系统文件,当出现下提示时,系统启动完成。
Cisco Internetwork Operating System Software
IOS (tm) C2950 Software (C2950-I6Q4L2-M), Version 12.1(22)EA4, RELEASE SOFTWARE(fc1)
Copyright (c) 1986-2005 by cisco Systems, Inc.
Compiled Wed 18-May-05 22:31 by jharirba
Press RETURN to get started!
步骤5:此时按一下键盘上的回车键就进入了交换机的用户配置模式。此时显示交换机的默认主机名为Switch,该模式下的提示符为“>”。在该模式下可用的命令比较少,可以使用“?”命令显示出该模式下的所有命令。
Switch>?
Exec commands:
connect Open a terminal connection
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
exitExit from the EXEC
logout Exit from the EXEC
ping Send echo messages
resumeResume an active network connection
showShow running system information
telnet Open a telnet connection
terminal Set terminal line parameters
traceroute Trace route to destination
Switch>
步骤6:在用户配置模式下键入“enable”命令进入特权模式。特权模式的提示符为“#”,所以也称为“#”模式。特权模式下可对交换机的配置文件进行管理,查看交换机的配置信息,进行网络的测试和调试等。键入?可以查看特权模式下所有命令。
Swich>enable
Switch#?
Exec commands:
clear Reset functions
clock Manage the system clock
configure Enter configuration mode
connect Open a terminal connection
copyCopy from one file to another
debug Debugging functions (see also 'undebug')
deleteDelete a file
dir List files on a filesystem
disable Turn off privileged commands
disconnect Disconnect an existing network connection
enable Turn on privileged commands
eraseErase a filesystem
exitExit from the EXEC
logout Exit from the EXEC
more Display the contents of a file
no Disable debugging informations
ping Send echo messages
reload Halt and perform a cold restart
resumeResume an active network connection
setup Run the SETUP command facility
showShow running system information
--More--
步骤7:全局配置模式下可以配置交换机的全局性参数。在特权模式下输入“config terminal”或者“config t”或者“conf t”就可以进入全局配置模式。全局配置模式也称为“config”模式,此配置模式下输入的命令会影响整个交换机的运行环境。
Switch#config t
Enter configuration commands, one per line. End with CNTL/Z.
Switch(config)#?
Configure commands:
access-list Add an access list entry
banner Define a login banner
bootBoot Commands
cdp Global CDP configuration subcommands
clock Configure time-of-day clock
crypto Encryption module
do To run exec commands in config mode
enable Modify enable password parameters
end Exit from configure mode
exitExit from configure mode
hostname Set system's network name
interface Select an interface to configure
ip Global IP configuration subcommands
line Configure a terminal line
logging Modify message logging facilities
macMAC configuration
mac-address-table Configure the MAC address table
mlsmls global commands
no Negate a command or set its defaults
port-channelEtherChannel configuration
privilege Command privilege parameters
--More—
步骤8:端口配置模式下可以对交换机的端口进行参数配置。一般交换机都拥有许多的端口,还可以添加不同的模块。默认情况下,交换机的所有端口都为以太网接口类型。进入端口配置模式,使用“interface ethernet<端口ID>”命令。
Switch(config)#interface f0/1
Switch(config-if)#?
cdp Global CDP configuration subcommands
channel-groupEtherchannel/port bundling configuration
channel-protocol Select the channel protocol (LACP, PAgP)
description Interface specific description
duplex Configure duplex operation.
exitExit from interface configuration mode
ip Interface Internet Protocol config commands
mlsmls interface commands
no Negate a command or set its defaults
shutdownShutdown the selected interface
spanning-tree Spanning Tree Subsystem
speed Configure speed operation.
storm-control storm configuration
switchport Set switching mode characteristics
tx-ring-limit Configure PA level transmit ring limit
步骤9:交换机各模式之间的切换可通过“exit”和“end”命令完成。
Switch>enable !从普通用户模式切换到特权用户模式
Switch#conf t !从特权用户模式进入全局配置模式
Switch(config)#int f0/1 !全局模式到接口配置模式
Switch(config-if)#exit !返回上一级模式
Swithcp(config)#end !直接返回到特权模式
Switch#disable !特权用户模式切换到普通用户模式
每日一言:
东隅已逝,桑榆非晚。