在命令行太长的情况下自动向左滚动
R1#$data you are hahaha too young too simple is a goodidea must know me
查看路由器命令历史记录
Ctrl+P或上箭头:显示最后一次输入的命令
Ctrl+N或下箭头:显示以前输入的命令
show history:默认显示最近输入的20个命令
show terminal:显示终端配置和历史记录缓冲区的大小
terminal history size:修改缓冲区的大小(最大为256)
R1#show history
configureterminal
config t
clock set15:21:36 november 2015
clock set 15:21:3615 november 2015
clock
jddl
clock jdf
sh serial 0/0/0
sh interfaceserial 0/0/0
sh interfacesf0/0
R1#show terminal
Line 0, Location: "", Type:
History is enabled, history size is 20.
R1#terminal history size 256
R1#
R1#show terminal
History is enabled, history size is 256.
2.5 收集基本的路由选择信息
R1#show version
Cisco IOS Software, 7200 Software (C7200-IK9S-M),Version 12.4(13b), RELEASE SOFTWARE (fc3)
Technical Support: http://www.cisco.com/techsupport
Copyright (c) 1986-2007 by Cisco Systems, Inc.
Compiled Wed 25-Apr-07 03:18 by prod_rel_team
R1 uptime is 43 minutes
System returned to ROM by unknown reload cause - suspectboot_data[BOOT_COUNT] 0x0, BOOT_COUNT 0, BOOTDATA 19
System restarted at 15:00:34 UTC Sun Nov 15 2015
1 FastEthernet interface
125K bytes of NVRAM.
65536K bytes of ATA PCMCIA card at slot 0 (Sector size512 bytes).
8192K bytes of Flash internal SIMM (Sector size 256K).
Configuration register is 0x2102
R1#show interfaces
FastEthernet0/0 is administratively down, line protocolis down
R1#show ip interface brief
Interface IP-Address OK? Method Status Protocol
FastEthernet0/0 unassigned YES unsetadministratively down down
FastEthernet0/0.1 unassigned YES unsetadministratively down down
R1#
3.路由器和交换机的管理配置
在路由器和交换机上,可配置的管理功能如下:
主机名;
旗标;
密码;
接口描述。
3.1 主机名
R1#config t
Enter configuration commands, one per line. End with CNTL/Z.
R1(config)#hostname sanyuan
sanyuan(config)#
3.2 旗标
创建一个旗标,向任何登录到路由器的人显示你想告诉他的信息。
有4种类型的旗标:
sanyuan(config)#banner ?
exec Set EXEC process creation banner
incoming Set incoming terminal line banner
login Set login banner
motd Set Message of the Day banner
MOTD是最常用的旗标。它向任何拨号或通过Telnet、辅助端口甚至控制台端口连接路由器的人显示一条消息
sanyuan(config)#banner motd #
Enter TEXT message.End with the character '#'.
hahaha
#
hahaha
sanyuan#
在一行中设置旗标:
sanyuan(config)#banner motd x wawawa x
3.3 设置密码
1.启用密码
sanyuan(config)#enable ?
last-resort Define enable action if no TACACS serversrespond
password Assign the privileged level password
secret Assign the privileged level secret
use-tacacs Use TACACS to check enable passwords
sanyuan(config)#enable secret yanjin
sanyuan(config)#enable pas
sanyuan(config)#enable password yanjin
The enable password you have chosen is the same as yourenable secret.
This is not recommended.Re-enter the enable password.
sanyuan(config)#line ?
<0-6> First Line number
aux Auxiliary line
console Primary terminal line
vty Virtual terminal
2.辅助端口密码
sanyuan(config)#line aux ?
<0-0> First Line number
sanyuan(config)#line aux 0
sanyuan(config-line)#login
% Login disabled on line 1, until 'password' is set
sanyuan(config-line)#pass
sanyuan(config-line)#password aux
sanyuan(config-line)#login
sanyuan(config-line)#
请别忘了执行命令login,否则辅助端口将不进行身份验证。
给线路设置密码前,思科不允许执行命令login,因为如果执行命令login后没有设置密码,该线路将不可用——它将提示用户输入根本不存在的密码。
3.控制台端口密码
sanyuan(config-line)#line console ?
% Unrecognized command
sanyuan(config)#line console ?
<0-0>First Line number
让路由器在没有设置Telnet密码也允许建立Telnet连接,我们可以使用no login命令:
sanyuan(config)#line vty 0 4
sanyuan(config-line)#no login
sanyuan(config-line)#
5.设置SSH
sanyuan(config)#hostname yanjin
yanjin(config)#ip dom
yanjin(config)#ip domain-nam
yanjin(config)#ip domain-name sanyuanempire.com
yanjin(config)#username yanjin password sanyuanempire
yanjin(config)#cry
yanjin(config)#crypto ke
yanjin(config)#crypto keyg
yanjin(config)#crypto key g
yanjin(config)#crypto key generate rs
yanjin(config)#crypto key generate rsa gen
yanjin(config)#crypto key generate rsa general-keys mo
yanjin(config)#crypto key generate rsa general-keysmodulus ?
<360-2048> size of the key modulus [360-2048]
yanjin(config)#crypto key generate rsa general-keysmodulus 1024
The name for the keys will be: yanjin.sanyuanempire.com
% The key modulus size is 1024 bits
% Generating 1024 bit RSA keys, keys will be non-exportable...[OK]
yanjin(config)#
Nov 15 16:44:09.707: %SSH-5-ENABLED: SSH 1.99 has beenenabled
yanjin(config)#ssh ver
yanjin(config)#ssh versio
yanjin(config)#ssh version 2
^
% Invalid input detected at '^' marker.
yanjin(config)#ssh ?
% Unrecognized command
yanjin(config)#line vty 0 ?
<1-15> Last Line number
<cr>
3.4 对密码进行加密
yanjin#sh running-config
Building configuration...
!
enable secret 5 $1$EtCD$nQpPMpOe/eSWrH9DptcoR1
enable password yanjin
yanjin#config t
Enter configuration commands, one per line. End with CNTL/Z.
yanjin(config)#servi
yanjin(config)#service pas
yanjin(config)#service password-encryption
yanjin(config)#exit
yanjin#sh running-config
enable secret 5 $1$EtCD$nQpPMpOe/eSWrH9DptcoR1
enable password 7 105708170F1E1C
仅当路由器的CPU使用率很高时,才需禁用加密服务。如果在设置密码前就启用了加密服务,则即使不查看密码,它们也会被加密。
yanjin#configure t
Enter configuration commands, one per line. End with CNTL/Z.
yanjin(config)#no ser
yanjin(config)#no service pa
yanjin(config)#no service pass
yanjin(config)#no service password-encryption