1网络工程师交换试验手册之一路由器的基本配置.docx
《1网络工程师交换试验手册之一路由器的基本配置.docx》由会员分享,可在线阅读,更多相关《1网络工程师交换试验手册之一路由器的基本配置.docx(10页珍藏版)》请在冰豆网上搜索。
1网络工程师交换试验手册之一路由器的基本配置
网络工程师交换试验手册之一:
路由器的基本配置
实验目的:
熟悉路由器的基本操作
路由器的3种工作模式
为路由器定义名称
为路由器添加特权密码
启用控制台密码
为TELNET访问启用密码
不执行DNS解析
配置路由器,使得控制台端口不会中止你的连接
配置路由器,使得路由器发送的控制台屏幕的消息不会附加到命令行中
配置路由器,使得当登陆控制台端口的时候显示一个标题。
为路由器接口配置IP地址。
查看配置结果。
实验拓扑:
实验内容:
[attach] [/attach]
1.路由器的3种用户模式
用户模式
Router>
Router>?
观察命令的多少
Execcommands:
access-enable CreateatemporaryAccess-Listentry
access-profile Applyuser-profiletointerface
clear Resetfunctions
connect Openaterminalconnection
disable Turnoffprivilegedcommands
disconnect Disconnectanexistingnetworkconnection
enable Turnonprivilegedcommands
exit ExitfromtheEXEC
help Descriptionoftheinteractivehelpsystem
lat Openalatconnection
lock Locktheterminal
login Loginasaparticularuser
logout ExitfromtheEXEC
mrinfo Requestneighborandversioninformationfromamulticast
router
mstat Showstatisticsaftermultiplemulticasttraceroutes
mtrace Tracereversemulticastpathfromdestinationtosource
name-connection Nameanexistingnetworkconnection
pad OpenaX.29PADconnection
ping Sendechomessages
ppp StartIETFPoint-to-PointProtocol(PPP)
resume Resumeanactivenetworkconnection
rlogin Openanrloginconnection
show Showrunningsysteminformation
slip StartSerial-lineIP(SLIP)
systat Displayinformationaboutterminallines
telnet Openatelnetconnection
terminal Setterminallineparameters
tn3270 Openatn3270connection
traceroute Traceroutetodestination
tunnel Openatunnelconnection
udptn Openanudptnconnection
where Listactiveconnections
x28 BecomeanX.28PAD
x3 SetX.3parametersonPAD
xremote EnterXRemotemode
特权模式
Router>enable(进入特权模式)
Router# 进入特权模式中,我们可以观察出特权模式与用户模式的不同在于对命令的使用权限的不同.
Router#?
Execcommands:
access-enable CreateatemporaryAccess-Listentry
access-profile Applyuser-profiletointerface
access-template CreateatemporaryAccess-Listentry
archive managearchivefiles
bfe Formanualemergencymodessetting
cd Changecurrentdirectory
clear Resetfunctions
clock Managethesystemclock
configure Enterconfigurationmode
connect Openaterminalconnection
copy Copyfromonefiletoanother
debug Debuggingfunctions(seealso'undebug')
delete Deleteafile
dir Listfilesonafilesystem
disable Turnoffprivilegedcommands
disconnect Disconnectanexistingnetworkconnection
enable Turnonprivilegedcommands
erase Eraseafilesystem
exit ExitfromtheEXEC
help Descriptionoftheinteractivehelpsystem
lat Openalatconnection
lock Locktheterminal
login Loginasaparticularuser
logout ExitfromtheEXEC
more Displaythecontentsofafile
mrinfo Requestneighborandversioninformationfromamulticast
router
mstat Showstatisticsaftermultiplemulticasttraceroutes
mtrace Tracereversemulticastpathfromdestinationtosource
name-connection Nameanexistingnetworkconnection
no Disabledebuggingfunctions
pad OpenaX.29PADconnection
ping Sendechomessages
ppp StartIETFPoint-to-PointProtocol(PPP)
pwd Displaycurrentworkingdirectory
reload Haltandperformacoldrestart
rename Renameafile
restart RestartConnection
resume Resumeanactivenetworkconnection
rlogin Openanrloginconnection
rsh Executearemotecommand
send Sendamessagetootherttylines
setup RuntheSETUPcommandfacility
show Showrunningsysteminformation
slip StartSerial-lineIP(SLIP)
start-chat Startachat-scriptonaline
systat Displayinformationaboutterminallines
telnet Openatelnetconnection
terminal Setterminallineparameters
test Testsubsystems,memory,andinterfaces
tn3270 Openatn3270connection
traceroute Traceroutetodestination
tunnel Openatunnelconnection
udptn Openanudptnconnection
undebug Disabledebuggingfunctions(seealso'debug')
verify Verifyafile
where Listactiveconnections
write Writerunningconfigurationt
配置模式
Router#config t(进入配置模式)
Router(config)#
接口模式
Router(config)#interfacetypenumber(选择要进入的接口)
Router(config)#interfaceethernet0进入以太网E0接口
Router(config-if)#
为路由器定义名称
router(config)#hostnamexxx(xxx为我们定义的名称)
Router(config)#hostfxh
fxh(config)#定义路由器的名称为FXH,那么对路由器定义名称,是为了区别我们所操作所有设备的不同.
为路由器添加特权密码
router(config)#enablepasswordsss(sss为我们定义的明文密码)
router(config)#enablesecretcisco(cisco为我们定义的密文密码)
启用控制台密码
router(config)#lineconsole0
router(config-line)#passwordxxx(xxx为我们定义的通过console端口进入路由器的密码)
router(config-line)#login(启用密码)
为telnet访问启用密码
router(config)#linevty04
router(config-line)#passowrdxxx(xxx为我们定义的密码)
router(config-line)#login作用是为了登陆使用
*如果执行telnet,必须设置enable密码和telnet密码才可以实现采用telnet登陆路由器。
不执行DNS解析
router(config)#noipdomain-lookup(这条命令的作用是:
当我们在执行命令错误的时候,路由器会认为这条命令没有错误,它只是一个域名的形式,那么他会给你解析,这样,很浪费我们宝贵的时间,
router#asd
Translating"asd"...domainserver(255.255.255.255)
(255.255.255.255)
Translating"asd"...domainserver(255.255.255.255)
%Unknowncommandorcomputername,orunabletofindcomputeraddress
这样输入命令后当你的输入在出现错误的时候,路由器会提示
router(config)#noipdomain-lookup
router(config)#^Z
router#asdf
05:
46:
49:
%SYS-5-CONFIG_I:
Configuredfromconsolebyconsole
Translating"asdf"
Translating"asdf"
%Unknowncommandorcomputername,orunabletofindcomputeraddress
)
配置路由器,使得控制台端口不会中止你的连接。
router(config-line)#exec-timeout0
我们在长时间不去操作路由器的时候,我们的路由器会自动的终止与我们的对话连接,跳转到非连接状态,这时候,我们还需要输入enable密码重新登陆,从某种意义上来讲是对安全性得到了保证,但是对我们的操作是十分的不方便的。
配置路由器,使得路由器发送的控制台屏幕的消息不会附加到命令行中
router(config)#lineconsole0
router(config-line)#loggingsynchronous
配置路由器,使得当登陆控制台端口的时候显示一个标题。
router(config)#bannermotd
EnterTEXTmessage. Endwiththecharacter'm'.在这里M是我们结束时候输入的结束控制字符,你最好找一个特殊的作为结束,例如~等等。
Xxxxxxx(是我们定义的信息)
为路由器的各种接口配置IP地址
router(config)#interface s0(进入接口)
router(config-if)#ipaddress192.168.1.1255.255.255.0(为接口添加IP地址)
router(config-if)#clockrate64000(定义接口时钟频率,仅用于DCE)
router(config-if)#noshut(启动端口)
router(config-if)#interfacee0
router(config-if)#ipaddress192.168.1.2255.255.255.0
router(config-if)#noshut
router(config-if)#interfacebri0(进入ISDN的接口)
router(config-if)#ipaddress192.168.1.3255.255.255.0
router(config-if)#noshut
router(config-if)#interfaces0.1(进入子接口)
router(config-if)#ipaddress192.168.1.4255.255.255.0
router(config-if)#noshut
router(config-if)#interfaceloopback0(进入逻辑的环回接口)
router(config-if)#ipaddress192.168.1.5255.255.255.0
router(config-if)#noshut
观察配置结果
router#showrun(察看路由器当前配置)
version12.1
noservicesingle-slot-reload-enable
servicetimestampsdebuguptime
servicetimestampsloguptime
noservicepassword-encryption
hostnameR2
ipsubnet-zero
!
interfaceLoopback0
noipaddress
interfaceEthernet0
ipaddress192.168.1.2255.255.255.0
!
interfaceSerial0
ipaddress192.168.1.1255.255.255.0
shutdown
clockrate64000
!
interfaceSerial0.1
ipaddress192.168.1.4255.255.255.0
!
interfaceSerial1
noipaddress
shutdown
!
ipclassless
iphttpserver
linecon0
lineaux0
linevty04
!
end
router#showipintbrief(察看路由器端口状态)
Interface IP-Address OK?
MethodStatus Prot
locol
Ethernet0 192.168.1.2 YESmanualup up
Loopback0 unassigned YESunset up up
Serial0 192.168.1.1 YESmanualadministrativelydowndown
Serial0.1 192.168.1.4 YESmanualadministrativelydowndown
Serial1 unassigned YESunset administrativelydowndow
备份和升级IOS软件
1:
IOS备份
首先安装tftp-server软件,这种软件在网络上到处都是,下载完成后,安装在你的机器上,这时候,你的PC就是一台tftp服务器了,然后进入路由器,这里需要主意的是,你的PC要与你的路由器的E0口保持连接状态,不管是直连还是通过交换网都可以。
Router#shflash:
查看本路由ios名称是什么。
Systemflashdirectory:
File Length Name/status
1 8083776 c2500-c-l.122-26.bin
[8083840bytesused,304764available,8388604total]
8192KbytesofprocessorboardSystemflash(ReadONLY)
router#copyflashtftp把flash中的信息拷贝到tftp中。
Addressornameofremotehost[]?
169.169.169.125(输入TFTP服务器地址)
Sourcefilename?
c2500-js-1.112-18.bin(输入源文件名称,这时候你可以通过查看过程中,把本机的flash名称copy下来,在这里粘贴就可以了。
)
Destinationfilename[c2500-js-1.112-18.bin]?
回车就可以了
2:
IOS升级
router#copytftpflash
基本与IOS的备份步骤相同,要求输入TFTP地址和源文件名称。
一路回车就可以了。
但是在这里需要主意的是:
Router#shflash:
Systemflashdirectory:
File Length Name/status
1 8083776 c2500-c-l.122-26.bin
[8083840bytesused,304764available,8388604total]
8192KbytesofprocessorboardSystemflash(ReadONLY)我们这里的flash信息是只读的,需要改变配置寄存器的值,使我们的flash保持可以读写状态。
Router(config)#config-register0x2101
Router#wri`
Router#reload就可以完成了,然后在继续上面的升级工作才可以。
管理配置文件
1:
配置更改的保存
Router#copyrunning-configstartup-config把配置文件从内存中保存到nvram中。
2:
配置文件的更新
Router#copystartup-c