Chapter4 Introduction to the Cisco IOS
The Cisco Router User Interface
Cisco Internetwork Operation System(IOS)是 Cisco 的 routers 和 switches 的内核
Cisco Router IOS
IOS 的一些功能:
1.运载网络协议和功能
2.对产生高速流量的设备进行连接
3.增加网络安全性
4.提供网络的可扩展性来简易化网络的增长和冗余问题
5.可靠的连接网络资源
你可以通过以下方式进入 IOS:
1.通过 router 的 console 口,用于本地
2.通过 modem 连接 auxiliary(Aux)口,用于远程
3.通过 VTY 线路来 telnet
Bringing Up a Router
当启动 1 个 router 的时候,大致将分为以下几个阶段:
1.开机自检(power-on self-test,POST)
2.如果 1 正常, 如果 IOS 存在的话,将从它的闪存(flash memory)查找和加载 IOS 到 RAM 中
(2500 系列不加载 RAM 中,直接从闪存中运行).闪存是 1 种电子可擦除只读存储器
(electronically erasable programmable read-only memory,EEPROM)
3.如果 1 和 2 正常,接下来它将在非易失性 RAM(NVRAM)
中查找启动配置文件 startup-config,
Overview of Router Modes
配置router,需要进入到1 个叫做配置模式的模式,在特权模式下输入configure terminal 进入全
局配置模式(global configuration mode),在这之下输入的命令叫做全局命令,一旦输入,将对整
个 router 产生影响.如下,注意提示符的变化:
Router#config
Configruation from terminal,memory or network
[terminal]?(press Enter)
Router(config)#
参数 terminal,memory 和 network 的区别:
1.configure terminal:配置 router 的 running-config,所谓 running-config 即为当前运行在动态
RAM(DRAM)的配置文件
2.configure memory: 配置 router 的 startup-config,所谓 startup-config 即为存储在 router 的
NVRAM 里的配置文件
3.configure network:配置存储在 TFTP 主机的配置文件
Interfaces
在全局配置模式下切换 router 接口,输入 interface 命令,?用于提示可选参数,为如下:
Router(config)#interface ?
(略)
Serial Serial
前半部分为参数,后半部分为描述,接着输入 serial 0,进入 router 接口配置模式,
如下:
Router(config)#interface serial 0
Router(config-if)#
Subinterfaces
在 router 的某个接口划分逻辑子接口(subinterface),输入命令进入子接口模式,如下,注意提示
3.假如你输入的命令不完整,将得到 1 个错误提示:Imcomplete command,这样有助于分析命令
哪出错了
4.router 支持命令缩写,比如 show 可以缩写为 sh,sho,但是假如你像如下那样输入了不完整的
缩写,将得到错误提示:Ambiguous command
Router#sh te
% Ambiguous command: sh te
Router#sh te?
tech-support template terminal
一切其他的快捷键:
1.Ctrl+A:把光标快速移动到整行的最开始
2.Ctrl+E:把光标快速移动到整行的最末尾
3.Esc+B:后退 1 个单词
4.Ctrl+B:后退 1 个字符
5.Esc+F:前进 1 个单词
6.Ctrl+F:前进 1 个字符
7.Ctrl+D:删除单独 1 个字符
8.Backspace:删除单独 1 个字符
9.Ctrl+R:重新显示 1 行
10.Ctrl+U:擦除 1 整行
11.Ctrl+W:删除 1 个单词
12.Tab:自动补齐命令
13.Up arrow 或者 Ctrl+P:显示之前最后输入过的命令
14.Down arrow 或者 Ctrl+N:显示之前刚刚输入过的命令
其他的一些关于历史的命令:
1.show history:显示最后输入的 10 条命令,默认是 10 条,可以修改该值
2.terminal history size:修改显示最后输入过的的命令的数量,默认是 10 条,最大是 256 条
3.show terminal:显示命令历史缓存大小,如下:
Router#sh terminal
enable secret:给 console 和 AUX 口加密,防止未授权用户进入特权模式,密码是加密形式,并且
一旦起用了这个密码,将凌驾于 enable password 之上,如果同时设置了 enable password 和
enable secret 的情况下,必须输入不同的密码,如下:
Router(config)#enable password 123
Router(config)#enable secret 123
The enable password you have chosen is the same as your enable secret.This is not
recommended.Re-enter the enable password
Router(config)#enable secret 321
如果 VTY 线路的密码没有设置,你将无法使用 telnet 来连上它
Auxiliary Password
配置 AUX 密码:
Router#conf t
Router(config)#line aux ?
<0-0> First line number
Router(config)#line aux 0
Router(config-line)#login
Router(config-line)#password 123
Console Password
配置 console 密码以及一些辅助命令:
Router#conf t
Router(config)#line console ?
<0-0> First line number
Router(config)#line console 0
Router(config-line)#login
Router(config-line)#password 123