思科基本配置命令详解.docx
- 文档编号:6562609
- 上传时间:2023-01-07
- 格式:DOCX
- 页数:60
- 大小:39.21KB
思科基本配置命令详解.docx
《思科基本配置命令详解.docx》由会员分享,可在线阅读,更多相关《思科基本配置命令详解.docx(60页珍藏版)》请在冰豆网上搜索。
思科基本配置命令详解
思科交换机基本配置实例讲解
1、基本概念介绍
IOS:
互联网操作系统,也就是交换机和路由器中用的操作系统
VLAN:
虚拟lan
VTP:
VLANTRUNKPROTOCOL
DHCP:
动态主机配置协议
ACL:
访问控制列表
三层交换机:
具有三层路由转发能力的交换机
本教程中“#”后的蓝色文字为注释内容。
2、密码、登陆等基本配置
本节介绍的内容为cisco路由器或者交换机的基本配置,在目前版本的cisco交换机或路由器上的这些命令是通用的。
本教程用的是cisco的模拟器做的介绍,一些具体的端口显示或许与你们实际的设备不符,但这并不影响基本配置命令的执行。
Cisco3640(R4700)processor(revision0xFF)with124928K/6144Kbytesofmemory.
ProcessorboardID00000000
R4700CPUat100MHz,Implementation33,Rev
2Ethernetinterfaces
8Serialinterfaces
DRAMconfigurationis64bitswidewithparityenabled.
125KbytesofNVRAM.
8192KbytesofprocessorboardSystemflash(Read/Write)
---SystemConfigurationDialog---
Wouldyouliketoentertheinitialconfigurationdialog?
[yes/no]:
n
#此处我们选择no,不进入他的初始化配置向导
PressRETURNtogetstarted!
#选择no以后,提示你按回车键开始,此处我们需要按回车键
*Mar100:
43:
:
%IP-5-WEBINST_KILL:
TerminatingDNSprocess
*Mar100:
43:
:
%SYS-5-RESTART:
Systemrestarted--
CiscoIOSSoftware,3600Software(C3640-JK9O3S-M),Version(14)T7,RELEASESOFTWARE(fc2)
TechnicalSupport:
(c)1986-2006byCiscoSystems,Inc.
CompiledWed22-Mar-0621:
46bypwade
*Mar100:
43:
:
%SNMP-5-COLDSTART:
SNMPagentonhostRouterisundergoingacoldstart
Router>
#等显示稳定后,出现最初的提示符,注意提示符是“>”,目前所处的状态称为用户模式。
Router>用户模式
Router>
Router>en
#如果在当前状态下没有重复的命令,我们可以用“TAB”键来补齐这条命令,主要目的是为了便于阅读
Router>enable进入特权模式
#从用户模式(usermode)进入到特权模式(execmode),注意提示符的变化,提示符变为“#”
Router#conft
Router#configureterminal进入全局模式
(说明:
#在特权模式下输入configureterminal进入全局配置模式(globalconfigurationmode),在这之下输入的命令叫做全局命令,一旦输入,将对整个router产生即时影响。
如下,注意提示符的变化:
)
Router(config)#exit#请注意提示符发生了改变,当前的模式据叫做全局配置模式。
Router#conf
*Mar100:
44:
:
%SYS-5-CONFIG_I:
Configuredfromconsolebyconsolet#在输入命令的过程中,IOS会出现一些即时提示。
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Router(config)#exit#退出当前的全局配置模式的命令是exit
Router#conft#重新进入到全局配置模式
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
Router(config)#
*Mar100:
44:
:
%SYS-5-CONFIG_I:
Configuredfromconsolebyconsolehos
#这行是路由器(交换机)出现的一些即时提示。
Router(config)#hostnametest
#这条命令用来更改当前设备的名字(名字中可包含设备的楼层、用途等信息),主要是为了将来便于区分设备。
test(config)#
#回车后我们就会发现,但前的设备的名字已经发生了改变,变成了test了。
test(config)#enablepass
#这条命令用来配置设备的登陆密码,用tab键补齐后,再下一行显示完整命令。
test(config)#enablepasswordcisco#我们输入这台设备的登陆密码为cisco
test(config)#end#我们退回到全局配置模式,校验一下刚才输入的密码
test#shr
#此命令的完整写法是showrunning-start,此处的shr用的是省略的写法,因无其他重复的命令所以可以被执行。
Buildingconfiguration...
Currentconfiguration:
1559bytes
!
version
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
noservicepassword-encryption
!
hostnametest#注意此处显示的是我们配置的设备的名字
!
boot-start-marker
boot-end-marker
!
enablepasswordcisco
#此处显示的是刚才我们配置的enable密码,注意此时是用明文显示的,有点不安全。
!
noaaanew-model
!
resourcepolicy
!
memory-sizeiomem5
ipsubnet-zero
!
#到这一行其实并未全部显示完配置的内容,我们可以按键盘上的任意键来终止继续显示。
在显示的过程中通过按回车键可以逐行显示,按空格键可以一页一页的显示。
这些操作可在实际的设备中体会。
test#conft#重新进入到全局配置模式
test(config)#servicepass
test(config)#servicepassword-encryption#利用这条命令给密码加密显示。
test(config)#end
test#shr#退出到全局配置模式后,验证刚才的配置。
Buildingconfiguration...
Currentconfiguration:
1565bytes
!
version
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
servicepassword-encryption
!
hostnametest
!
boot-start-marker
boot-end-marker
!
enablepassword7070C285F4D06cisco
#注意此处刚才明文显示的密码已经变成加密显示了,这样从一定程度上保证了密码的安全。
!
noaaanew-model
!
resourcepolicy
!
memory-sizeiomem5
ipsubnet-zero
!
#验证完毕后按任何一个键中断显示,下面的内容说明终端登陆密码的配置。
test#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
test(config)#noservicepassword-encryption
#可利用这条命令(前面加no)来去掉密码加密功能,cisco的所有命令都可以通过这种方式来禁止。
test(config)#linecon
test(config)#lineconsole0#利用这条命令来配置用超级终端登陆时的一些参数。
test(config-line)#pass
test(config-line)#passwordcisco#添加密码,此处我们配置的密码为cisco
test(config-line)#loggi
test(config-line)#logging?
#在任何情况下如果你忘记了命令的相关参数可以用?
来获得提示和帮助
synchronousSynchronizedmessageoutput
test(config-line)#loggingsy
test(config-line)#loggingsynchronous
#在我们进行配置时,IOS会产生一些即时的提示信息,而这些信息会冲乱我们的光标显示,用这条命令可以将光标规矩在下一行,即使出现了一些即时的提示。
test(config-line)#exit#退出当前console口的参数配置
test(config)#linevt?
#telnet登陆时相关参数的配置,此处用了?
来寻求提示。
<0-134>FirstLinenumber
auxAuxiliaryline
consolePrimaryterminalline
ttyTerminalcontroller
vtyVirtualterminal
x/ySlot/PortforModems
test(config)#linevty04
#我们配置虚拟终端的0到4,也就是同时允许5个用户可以telnet到这台设备上来。
test(config-line)#pass
test(config-line)#passwordcisco
#我们配置telnet时的密码为cisco,如果此处我们不设置密码,那么用telnet来登陆的时候并不会以空密码登陆,而是会给你提示说:
相关密码没有设置,禁止登陆。
所以我们为了能远程telnet到这台设备,此处的密码一定要设置好。
test(config-line)#login#这条命令是允许通过telnet来登录
test(config-line)#exit#退出当前配置模式到全局配置模式。
test(config)#
test(config)#
test#confs
#我们在做配置的时候,会出现输入错误的情况,在这种情况下ios会以为你输入的是一个域名
Translating"s"...domainserver
#那么ios会做长时间的搜寻,试图找到这个域名对应的ip地址.......
Translating"s"...domainserver
#这段时间是比较长的,那么我们如何禁用它的这个功能呢?
%Unknowncommandorcomputername,orunabletofindcomputeraddress
test#conft
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
test(config)#noipdomain-lookup#在全局配置模式下,将ip域名的搜寻功能关闭就可以了。
test(config)#end
test#conf
*Mar101:
40:
:
%SYS-5-CONFIG_I:
Configuredfromconsolebyconsole
test#confx#将上述功能关闭以后,再有输入错误的情况会直接提示你输入错误。
^
%Invalidinputdetectedat'^'marker.
test#
test(config)#ipdomain-name
#如果有必要将设备配置上DNS功能的话就用这条命令。
###基本配置完毕后我们验证一下所有的配置###
test#shrun
Buildingconfiguration...
Currentconfiguration:
1693bytes
!
version
servicetimestampsdebugdatetimemsec
servicetimestampslogdatetimemsec
servicepassword-encryption#密码加密显示功能打开
!
hostnametest
!
boot-start-marker
boot-end-marker
!
enablepassword7070C285F4D06#密码被加密显示了
!
noaaanew-model
!
resourcepolicy
!
memory-sizeiomem5
ipsubnet-zero
!
!
ipcef
noipdomainlookup#关闭了域名查找功能
noipdhcpusevrfconnected
!
!
noipipsdeny-actionips-interface
!
noftp-serverwrite-enable
!
nocryptoisakmpccm
!
(略……)
iphttpserver
noiphttpsecure-server
ipclassless
!
control-plane
!
linecon0
exec-timeout00
password7094F471A1A0A#用超级终端登陆的密码,也同样被加密显示
loggingsynchronous
lineaux0
linevty04
password700071A150754#用telnet登陆的密码,也同样被加密显示
login
!
!
end
test#
3、cisco设备端口配置详解
UserAccessVerification
#从dos提示符下运行telnetip地址,就会连接到相应的交换机或者路由器
Password:
#输入配置号的telnet密码,也就是上节提到的vtp中的密码
test>en#进入特权模式
Password:
#输入特权模式密码,也就是上节提到的enable密码。
注意这些密码在输入的时候屏幕是不显示的。
test#
test#
test#shipintbrief#查看当前所有端口状态,包括vlan和实际的物理接口状态
InterfaceIP-AddressOK?
MethodStatusProtocol协议#这行列示的各种状态的名称
FastEthernet1unassigned未分配YESNVRAMdowndown
Vlan1YESNVRAMupup
#vlan1的状态是active
Vlan2YESNVRAMupup
Vlan10YESNVRAMupup
Vlan20YESNVRAMupup
Vlan30YESNVRAMupup
Vlan40YESNVRAMupup
Vlan50YESNVRAMupup
Vlan60YESNVRAMupup
Vlan70YESNVRAMupup
Vlan80YESNVRAMupup
Vlan100YESNVRAMupup
Vlan110YESNVRAMupup
Vlan120YESNVRAMupup
Vlan150YESNVRAMupup
Vlan160YESNVRAMupup
GigabitEthernet1/1unassignedYESunsetupup
#物理接口gi1/1也是active状态
GigabitEthernet1/2unassignedYESunsetdowndown
GigabitEthernet1/3unassignedYESunsetdowndown
GigabitEthernet1/4unassignedYESunsetdowndown
GigabitEthernet1/5unassignedYESunsetdowndown
GigabitEthernet1/6unassignedYESunsetdowndown
GigabitEthernet1/7unassignedYESunsetdowndown
GigabitEthernet1/8unassignedYESunsetdowndown
GigabitEthernet1/9unassignedYESunsetdowndown
#说明:
通过上述命令即可以查看当前设备所有状态的情况也可以查看端口的表示方式。
在此例中我们登陆的是一台cisco4503的三层交换机;其中GigabitEthernet1/1,表示的是这台交换机上的第1块业务板的第1个端口,并且此端口是个千兆端口;而GigabitEthernet3/19表示的是这台交换机上的第3块业务版的第19个端口,并且此端口也是一个千兆端口,其他的端口以此类推。
千兆端口的名称为:
GigabitEthernet,百兆端口的名称为:
FastEthernet。
test#conft
#进入到全局配置模式。
要想对端口、vlan、路由等操作一定要到全局配置模式中来。
Enterconfigurationcommands,oneperline.EndwithCNTL/Z.
test(config)#inter
test(config)#interfacegi1/2进入Gi1/2端口
#通过此命令可进去端口配置模式,此处我们进入的是GigabitEthernet1/2口,gi1/2为简写。
test(config-if)#?
#回车后进入到端口配置模式,注意提示符的变化,输入?
寻求在这个模式着那个的帮助。
Interfaceconfigurationcommands:
access-groupAccessgroupconfiguration
arpSetarptype(arpa,probe,snap)ortimeout
autoConfigureAutomation
backupModifybackupparameters
bandwidthSetbandwidthinformationalparameter
bgp-policyApplypolicypropogatedbybgpcommunitystring
carrier-delaySpecifydelayforinterfacetransitions
cdpCDPinterfacesubcommands
channel-groupEtherchannel/portbundlingconfiguration
channel-protocolSelectthechannelprotocol(LACP,PAgP)
dampeningEnableeventdampening
defaultSetacommandtoitsdefaults
delaySpecifyinterfacethroughputdelay
descriptionInterfacespecificdescription
dot1xInterfaceConfigCommandsfor
duplexConfigureduplexoperation.
exitExitfrominterfaceconfigurationmode
flow-samplerAttachflowsamplertotheinterface
flowcontrolConfigureflowoperation.
helpDescriptionoftheinteractivehelpsystem
ipInterfaceInternetProtocolconfigcommands
isisIS-IScommands
iso-igrpISO-IGRPinterfacesubcommands
keepaliveEnablekeepalive
l2protocol-tunnelTunnelLayer2protocols
lacpLACPinterfacesubcommands
load-intervalSpecifyintervalforloadcalculationforaninterface
loggingConfigureloggingforinterface
loopbackConfigureinternalloopbackonaninterface
macMACinterfacecommands
macroCommandmacro
max-reserved-bandwidthMaximumReservableBandwidthonanInterface
mtuSettheinterfaceMaximumTransmissionUnit(MTU)
noNegateacommandorsetitsdefaults
pagpPAgPinterfacesubcommands
powerPowerconfiguration
qosQoSconfiguration
rmonConfigureRemoteMonitoringonaninterface
service-policyConfigure
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- 思科 基本 配置 命令 详解