1交换机的基本配置.docx
- 文档编号:8254220
- 上传时间:2023-01-30
- 格式:DOCX
- 页数:10
- 大小:24.02KB
1交换机的基本配置.docx
《1交换机的基本配置.docx》由会员分享,可在线阅读,更多相关《1交换机的基本配置.docx(10页珍藏版)》请在冰豆网上搜索。
1交换机的基本配置
交换机的基本配置
【实验目的】
掌握交换机命令行各种操作模式的区别,能够使用各种帮助信息,以及用命令进行基本的配置。
【描述背景】
你是某公司新进的网管,公司要求你熟悉网络产品,公司采用全系列锐捷网络产品,首先要求你登录交换机,了解、掌握交换机的命令行操作技巧,以及如何使用一些基本命令进行配置。
【需求分析】
需要在交换机上熟悉各种不同的配置模式以及如何在配置模式间切换,使用命令进行基本的配置,并熟悉命令行界面的操作技巧。
【实验拓扑】
【实验设备】
交换机1台计算机1台
【预备知识】
交换机的命令行界面和基本操作
【实验原理】
交换机的管理方式基本分为两种:
带内管理和带外管理。
通过交换机的Console口管理交换机属于带外管理,不占用交换机的网络接口,其特点是需要使用配置线缆,近距离配置。
第一次配置交换机时必须利用Console端口进行配置。
交换机的命令行操作模式,主要包括:
用户模式、特权模式、全局配置模式、端口模式等几种。
Ø用户模式进入交换机后得到的第一个操作模式,该模式下可以简单查看交换机的软、硬件版本信息,并进行简单的测试。
用户模式提示符为switch>
Ø特权模式由用户模式进入的下一级模式,该模式下可以对交换机的配置文件进行管理,查看交换机的配置信息,进行网络的测试和调试等。
特权模式提示符为switch#
Ø全局配置模式属于特权模式的下一级模式,该模式下可以配置交换机的全局性参数(如主机名、登录信息等)。
在该模式下可以进入下一级的配置模式,对交换机具体的功能进行配置。
全局模式提示符为switch(config)#
Ø端口模式属于全局模式的下一级模式,该模式下可以对交换机的端口进行参数配置。
端口模式提示符为switch(config-if)#
交换机的基本操作命令包括:
ØExit命令是退回到上一级操作模式。
ØEnd命令是指用户从特权模式以下级别直接返回到特权模式。
Ø交换机命令行支持获取帮助信息、命令的简写、命令的自动补齐、快捷键功能。
配置交换机的设备名称和配置交换机的描述信息必须在全局配置模式下执行。
ØHostname配置交换机的设备名称。
Ø当用户登录交换机时,你可能需要告诉用户一些必要的信息。
你可以通过设置标题来达到这个目的。
你可以创建两种类型的标题:
每日通知和登录标题。
⏹Bannermotd配置交换机每日提示信息motdmessageoftheday。
⏹Bannerlogin配置交换机登录提示信息,位于每日提示信息之后。
Ø查看交换机的系统和配置信息命令要在特权模式下执行。
a)Showversion查看交换机的版本信息,可以查看到交换机的硬件版本信息和软件版本信息,用于进行交换机操作系统升级时的依据。
b)Showmac-address-table查看交换机当前的MAC地址表信息
c)Showrunning-config查看交换机当前生效的配置信息。
【实验步骤】
第一步:
交换机各个操作模式直接的切换
Swtich>enable
//使用enable命令从用户模式进入特权模式
Swtich#configureterminal
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
//使用configureterminal命令从特权模式进入全局配置模式
Swtich(config)#interfacefastEthernet0/1
//使用interface命令进入接口配置模式
Swtich(config-if)#exit
//使用exit命令退回上一级操作模式
Swtich(config)#interfacefastEthernet0/2
Swtich(config-if)#end
//使用end命令直接退回特权模式
第二步:
交换机命令行界面基本功能
Switch>?
//显示当前模式下所有可执行的命令
disableTurnoffprivilegedcommands
enableTurnonprivilegedcommands
exitExitfromtheEXEC
helpDescriptionoftheinteractivehelpsystem
pingSendechomessages
rcommandRuncommandonremoteswitch
showShowrunningsysteminformation
telnetOpenatelnetconnection
tracerouteTraceroutetodestination
Swtich>en
Swtich>enable//使用tab键补齐命令
Swtich#con?
configureconnect//使用?
显示当前模式下所有以“con”开头的命令
Swtich#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Swtich(config)#//使用命令的简写
Swtich(config)#interface?
//显示interface命令后可执行的参数
AggregateportAggregateportinterface
DialerDialerinterface
FastEthernetFastIEEE802.3
GigabitEthernetGbyteEthernetinterface
LoopbackLoopbackinterface
MultilinkMultilink-groupinterface
NullNullinterface
TunnelTunnelinterface
Virtual-pppVirtualPPPinterface
Virtual-templateVirtualTemplateinterface
VlanVlaninterface
rangeInterfacerangecommand
Switch(config)#interface
Swtich(config)#interfacefastEthernet0/1
Switch(config-if)#^Z
Switch#//使用快捷键“Ctrl+Z”可以直接退回到特权模式
Switch#ping192.168.1.2
sending5,100-byteICMPEchosto192.168.1.2,
timeoutis2000milliseconds.
.^C
Switch#//在交换机特权模式下执行ping192.168.1.2命令,发现不能ping通目标地址,交换机默认情况下需要发送5个数据包,如不想等到5个数据包均不能ping通目标地址的反馈出现,可在数据包未发出5个之前通过执行快捷键“Ctrl+C”终止当前操作。
第三步:
配置交换机的名称和每日提示信息
Switch(config)#hostnameSW-1//使用hostname命令更改交换机的名称
SW-1(config)#bannermotd$
EnterTEXTmessage.Endwiththecharacter'$'.
//使用banner命令设置交换机的每日提示信息,参数motd指定以哪个字符为信息的
结束符
$//输入上述字符或nobannermotd$即可退出该模式
第四步:
配置接口状态
SW-1(config)#interfacefastEthernet0/1//进入端口F0/1的配置模式
SW-1(config-if)#speed10//配置端口速率为10M
SW-1(config-if)#duplexhalf//配置端口的双工模式为半双工
SW-1(config-if)#noshutdown//开启端口,使端口转发数据。
交换机端口默认已经开启。
SW-1(config-if)#description"ThisisaAccessport."//配置端口的描述信息,可作为提示。
SW-1(config-if)#end
SW-1#Nov2522:
06:
37%SYS-5-CONFIG_I:
Configuredfromconsolebyconsole
SW-1#
SW-1#showinterfacefastEthernet0/1
Index(dec):
1(hex):
1
FastEthernet0/1isUP,lineprotocolisUP
HardwareismarvellFastEthernet
Description:
"ThisisaAccessport."
Interfaceaddressis:
noipaddress
MTU1500bytes,BW10000Kbit
EncapsulationprotocolisBridge,loopbacknotset
Keepaliveintervalis10sec,set
Carrierdelayis2sec
RXloadis1,Txloadis1
Queueingstrategy:
WFQ
Switchportattributes:
interface'sdescription:
""ThisisaAccessport.""
medium-typeiscopper
lastchangetime:
329Day:
22Hour:
5Minute:
2Second
Priorityis0
adminduplexmodeisForceHalfDuplex,operduplexisHalf
adminspeedis10M,operspeedis10M
flowcontroladminstatusisOFF,flowcontroloperstatusisOFF
broadcastStormControlisOFF,multicastStormControlisOFF,unicastStorm
ControlisOFF
5minutesinputrate0bits/sec,0packets/sec
5minutesoutputrate0bits/sec,0packets/sec
0packetsinput,0bytes,0nobuffer,0dropped
Received0broadcasts,0runts,0giants
0inputerrors,0CRC,0frame,0overrun,0abort
0packetsoutput,0bytes,0underruns,0dropped
0outputerrors,0collisions,0interfaceresets
SW-1#如果需要将交换机端口的配置恢复默认值,可以使用default命令。
SW-1(config)#interfacefastEthernet0/1
SW-1(config-if)#defaultbandwidth//恢复端口默认的带宽设置
SW-1(config-if)#defaultdescription//取消端口的描述信息
SW-1(config-if)#defaultduplex//恢复端口默认的双工设置
SW-1(config-if)#end
SW-1#Nov2522:
11:
13%SYS-5-CONFIG_I:
Configuredfromconsolebyconsole
SW-1#
SW-1#showinterfacefastEthernet0/1
Index(dec):
1(hex):
1
FastEthernet0/1isUP,lineprotocolisUP
HardwareismarvellFastEthernet
Interfaceaddressis:
noipaddress
MTU1500bytes,BW100000Kbit
EncapsulationprotocolisBridge,loopbacknotset
Keepaliveintervalis10sec,set
Carrierdelayis2sec
RXloadis1,Txloadis1
Queueingstrategy:
WFQ
Switchportattributes:
interface'sdescription:
""
medium-typeiscopper
lastchangetime:
329Day:
22Hour:
11Minute:
13Second
Priorityis0
adminduplexmodeisAUTO,operduplexisFull
adminspeedisAUTO,operspeedis100M
flowcontroladminstatusisOFF,flowcontroloperstatusisON
broadcastStormControlisOFF,multicastStormControlisOFF,unicastStorm
ControlisOFF
5minutesinputrate0bits/sec,0packets/sec
5minutesoutputrate0bits/sec,0packets/sec
0packetsinput,0bytes,0nobuffer,0dropped
Received0broadcasts,0runts,0giants
0inputerrors,0CRC,0frame,0overrun,0abort
0packetsoutput,0bytes,0underruns,0dropped
0outputerrors,0collisions,0interfaceresets
SW-1#
第五步:
查看交换机的系统和配置信息
SW-1#showversion//查看交换机的系统信息
Systemdescription:
RuijieDualStackMulti-LayerSwitch(S3760-24)By
RuijieNetwork//交换机的描述信息(型号等)
Systemstarttime:
2008-11-2521:
58:
44
Systemhardwareversion:
1.0//设备的硬件版本信息
Systemsoftwareversion:
RGNOS10.2.00
(2),Release(27932)//操作系统版本信息
Systembootversion:
10.2.27014
SystemCTRLversion:
10.2.24136
Systemserialnumber:
0000000000000
SW-1#
SW-1#showrunning-config//查看交换机的配置信息
Buildingconfiguration...
Currentconfiguration:
1279bytes
versionRGNOS10.2.00
(2),Release(27932)(ThuDec1310:
31:
41CST2007
-ngcf32)
hostnameSW-1
vlan1
!
noservicepassword-encryption
!
interfaceFastEthernet0/1
!
interfaceFastEthernet0/2
!
interfaceFastEthernet0/3
!
interfaceFastEthernet0/4
!
interfaceFastEthernet0/5
!
interfaceFastEthernet0/6
!
interfaceFastEthernet0/7
!
interfaceFastEthernet0/8
!
interfaceFastEthernet0/9
!
interfaceFastEthernet0/10
!
interfaceFastEthernet0/11
!
interfaceFastEthernet0/12
!
interfaceFastEthernet0/13
!
interfaceFastEthernet0/14
!
interfaceFastEthernet0/15
!
interfaceFastEthernet0/16
!
interfaceFastEthernet0/17
!
interfaceFastEthernet0/18
!
interfaceFastEthernet0/19
!
interfaceFastEthernet0/20
!
interfaceFastEthernet0/21
!
interfaceFastEthernet0/22
!
interfaceFastEthernet0/23
!
interfaceFastEthernet0/24
!
interfaceGigabitEthernet0/25
!
interfaceGigabitEthernet0/26
!
interfaceGigabitEthernet0/27
!
interfaceGigabitEthernet0/28
!
!
linecon0
linevty04
login
!
!
bannermotd^C
WelcometoSW-1,ifyouareadmin,youcanconfigit.
Ifyouarenotadmin,pleaseEXIT!
^C
!
End
第六步:
保存配置
下面的3条命令都可以保存配置
SW-1#copyrunning-configstartup-config
SW-1#writememory
SW-1#write
【注意事项】
1、命令行操作进行自动补齐或命令简写时,要求所简写的字母必须能够惟一区别该命令。
如switch#conf可以代表configure,但switch#co无法代表configure,因为co开头的命令有两个copy和configure,设备无法区别。
2、注意区别每个操作模式下可执行的命令种类。
交换机不可以跨模式执行命令。
3、配置设备名称的有效字符是22个字节。
4、配置每日提示信息时,注意终止符不能在描述文本中出现。
如果键入结束的终止符后仍然输入字符,则这些字符将被系统丢弃。
5、交换机端口在默认情况下是开启的,AdminStatus是UP状态,如果该端口没有实际连接其他设备,OperStatus是down状态。
6、showrunning-config查看的是当前生效的配置信息,该信息存储在RAM(随机存储器里),当交换机掉电,重新启动时会重新生成新的配置信息
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 交换机 基本 配置