Chinaunix首页 | 论坛 | 博客
  • 博客访问: 594005
  • 博文数量: 110
  • 博客积分: 8016
  • 博客等级: 中将
  • 技术积分: 1217
  • 用 户 组: 普通用户
  • 注册时间: 2006-06-28 10:14
文章分类

全部博文(110)

文章存档

2008年(1)

2007年(13)

2006年(96)

我的朋友

分类: 系统运维

2006-06-28 15:14:50

The Cisco Router User Interface

Cisco Internetwork Operation System(IOS)Cisco routersswitches的内核

Cisco Router IOS

IOS的一些功能:

1.运载网络协议和功能

2.对产生高速流量的设备进行连接

3.增加网络安全性

4.提供网络的可扩展性来简易化网络的增长和冗余问题

5.可靠的连接网络资源

你可以通过以下方式进入IOS:

1.通过routerconsole,用于本地

2.通过modem连接auxiliary(Aux),用于远程

3.通过VTY线路来telnet

Bringing Up a Router

当启动1router的时候,大致将分为以下几个阶段:

1.开机自检(power-on self-test,POST)

2.如果1正常, 如果IOS存在的话,将从它的闪存(flash memory)查找和加载IOSRAM(2500系列不加载RAM,直接从闪存中运行).闪存是1种电子可擦除只读存储器(electronically erasable programmable read-only memory,EEPROM)

3.如果12正常,接下来它将在非易失性RAM(NVRAM)中查找启动配置文件startup-config,假如没有找到任何启动配置文件,router将进入到setup模式

Setup Mode

setup模式可以对router进行些配置,但是我们不推荐使用这个方法对router进行配置.它分为2种模式:

1.Basic Management

2.Extended Management

setup模式中,[]代表默认设置,你可以使用Ctrl+C随时退出setup模式

Command-Line Interface

当问你是否进入setup模式,选择no,即进入命令行模式


 

Logging into the Router

从用户模式(user mode)进入到特权模式(exec mode),注意提示符的变化:

Router>enable

Router#

从特权模式退出到用户模式:

Router#disable

Router>

退出router命令行:在用户模式和特权模式下输入logout,如下:

Router#logout

Router con0 is now available

Press RETURN to get started

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,memorynetwork的区别:

1.configure terminal:配置routerrunning-config,所谓running-config即为当前运行在动态RAM(DRAM)的配置文件

2.configure memory: 配置routerstartup-config,所谓startup-config即为存储在routerNVRAM里的配置文件

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),输入命令进入子接口模式,如下,注意提示符:

Router(config)#interface fa0/0.?

<0-4294967295> FastEhernet interface number

Router(config)#interface fa0/0.1

Router(config-subif)#

Line Command

进入线路配置模式,注意提示符,如下:

Router(config)#line console 0

Router(config-line)#

Routing Protocol Configurations

router配置路由协议,比如RIP,注意提示符,如下:

Router(config)#router rip

Router(config-router)#

从全局模式退出到特权模式可以使用快捷键Ctrl+Z

Editing and Help Features

一些特写:

1.在命令行下输入?,将得到该模式下可以使用的命令列表以及其描述

2.假如你不确定1个命令是如何写的,比如你只记得是字母c开头,你可以输入c1?,将得到该模式下可以使用的所有命令:

Router#c?

clear clock configuration connect copy

Router#clock ?

set Set the time and date

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

()

History is enabled,history size is 10

()

Router#terminal history size ?

<0-256> Size of history buffer

Router#terminal history size 25

Router#sh terminal

()

History is enabled,history size is 25

()

Gather Basic Routing Information

show version:显示系统硬件的基本配置和软件版本,以及配置文件的名字和来源,还有启动镜象,最后是configuration register的值

Set Passwords:

5种密码用于加密你的Cisco router:

1.控制口(console)

2.辅助口(AUX)

3.VTY

4.enable password

5.enable secret

Enable Passwords


 

enable password:consoleAUX口加密,防止未授权用户进入特权模式,但是密码是非加密形式

enable secret:consoleAUX口加密,防止未授权用户进入特权模式,密码是加密形式,并且一旦起用了这个密码,将凌驾于enable password之上,如果同时设置了enable passwordenable 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

Router(config-line)#exec-timeout ?

<0-35791> Timeout in minutes

Router(config-line)#exec-timeout 0 ?

<0-2147483> Timeout in seconds

Router(config-line)#exec-timeout 0 0

Router(config-line)#logging synchonous

exec-timeout命令:如果X分钟X秒不活动的话将自动退出,默认是10分钟,0 0代表永远不自动退出

logging synchronous:光标跟随

Telnet Password


 

配置VTY密码:如果你的IOS不是企业版(Enterprise edition),默认你只能有5VTY线路,线路04.配置如下:

Router(config-line)#line vty 0 ?

<1-4> Last Line Number

Router(config-line)#line vty 0 4

Router(config-line)#login

Router(config-line)#password 123

刚才说过了,如果你的VTY线路没有配置密码的话,你将无法telnet连上它,它会报错:VTY线路没有配置密码.但是你可以取消VTY密码,这样就可以在没有密码的情况下进行telnet,处于安全考虑,此方法不推荐,配置如下:

Router(config-line)#line vty 0 4

Router(config-line)#no login

Encryption Your Passwords

只有enable secret是加密的,当你在特权模式下输入sh running-config显示DRAM的配置文件时,其他密码将被罗列出来:

Router#sh run

()

!

enable secret jhdflkdfg$#sdf

enable password 123

!

()

对密码进行加密:在全局配置模式下使用service password-encryption命令

Banners

banner类似标语,问候语.最常用的是MOTD(message of the day),分界符用于分隔信息,但是分隔符不能出现在MOTD信息中,如下:

Router(config)#banner motd #

The Router is mine

#

Router(config)#^Z(Ctrl+Z)

Router#exit

Router con0 is now available

Press RETURN to get started

The Router is mine

Router>


 

其他的3banner:

1.exec banner

2.incoming banner

3.login banner

Router Interfaces

配置router的接口,一般命令模式采用:interface type number的格式,比如:

Router(config)#int ethernet 0

但是Cisco2600,3600,40007000等系列采用了物理卡槽和模块化的端口机制.因此,命令变化为:interface type slot/port,比如:

Router(config)#int fastethernet 0

% Imcomplete command

Router(config)#int fastethernet 0?

/

Router(config)#int fastethernet 0/?

<0-1> Fastethernet interface number

Router(config)#int fastethernet 0/1

配置连接器的介质类型,使用media-type命令,不过这个一般是自动检测,如下:

Router(config)#int fa 0/0

Router(config-if)#media-type ?

100BaseX Use RJ45 for -TX; SC F0 for –FX

MII Use MII connector

Bring Up an Interface

打开和关闭1个接口,分别使用shutdownno shutdown命令,当你关闭某个接口的时候,使用sh interfaces命令可以查看接口状态,并且你将看到以下输出:

Router#sh int e0

Ethernet0 is administratively down,line protocol is down

()

接口是关闭的,所以你要手动打开它,如下:

Router#conf t

Router(config)#int e0

Router(config-if)#no shut

Router(config-if)#^Z

Router#sh int e0

Ethernet is up,line protocol is up

()

Configuring an IP Address on an Interface

给某个接口配置IP地址,使用ip address [address] [mask]命令,如下:


 

Router(config)#int e0

Router(config-if)#ip address 172.16.10.2 255.255.255.0

记得把接口打开:

Router(config-if)#no shut

Router(config-if)#^Z

如果你需要在1个接口添加第二个子网地址,在末尾使用secondary参数,这将替换现有IP地址,如下:

Router(config)#int e0

Router(config-if)#ip address 172.16.20.2 255.255.255.0 secondary

Router(config-if)#^Z

来验证下:

Router#sh run

()

!

interface Ethernet0

ip address 172.16.20.2 255.255.255.0 secondary

ip address 172.16.10.2 255.255.255.0

!

Serial Interface Commands

Serial口一般是连接在CSU/DSU等类型的提供时钟频率的设备上.但是,假如你在个实验环境里采用了背对背配置,那么1端将作为DCE设备提供时钟频率.默认Ciscorouter都是DTE,所以你必须让1serial接口来提供时钟频率,采用的命令是:clock rate,如下:

Router(config)#int s0

Router(config-if)#clock rate ?

Speed (bits per second)

1200

()

56000

64000

()

Router(config-if)#clock rate 64000

% Error: This commands applies only to DCE interfaces

Router(config-if)#int s1

Router(config-if)#clock rate 64000

确定serial接口是否是DCE线缆使用sh controllers命令,如下:

Router>sh controllers s 0

HD unit 0, idb=0x297DE8, driver structure at 0x29F3A0

Buffer size 1524 HD unit 0, V.35 DCE cable

Ciscorouter的默认serial连接带宽是T-1(1.544Mbps).有的路由协议要以带宽做为度来进


 

行衡量,所以,我们给它配置带宽,使用bandwidth命令,注意参数单位是kb,如下:

Router(config-if)#bandwidth ?

<1-10000000> Bandwidth in kilobits

Router(config-if)#bandwidth 64

Hostnames

router配置主机名,使用hostname命令,这个是本地标志,不影响routerInternet上的工作,注意回车立即生效,如下:

Router(config)#hostname Noko

Noko(config)#hostname Noco

Noco(config)#

Descriptions

description命令:本地标志,可以给接口加描述,以便用于区分,如下:

Noco(config)#int e0

Noco(config-if)#description Sales LAN

Noco(config-if)#^Z

来验证下:

Noco#sh int e0

()

Description: Sales LAN

()

Viewing and Saving Configurations

running-config(DRAM)的文件复制到startup-config(NVRAM),使用copy running-config startup-config命令:

Noco#copy run start

可以使用erase startup-config命令删除startup-config文件,如下:

Noco#erase startup-config

()

Noco#sh start

%% Non-volatile configuration memory is not present

假如在这个情况下在特权模式使用reload命令重新启动router,将进入setup模式

Verifying Your Configuration

ping:采用了ICMP echo requestsreplies

traceroute:使用ICMPIP TTL来跟踪包所经过的路径

Verifying with the show ip interface Command


 

show ip interface:提供router接口的层3信息,包括:

1.接口状态

2.IP地址和掩码

3.访问列表(access-list)信息

4.一些其他的基本的IP信息

Using the show ip interface brief Command

show ip interface brief:show ip interface类似,只是提供简洁点的总结信息

Using the show controllers Command

sh controllers:显示物理接口的信息,还提供serial口线缆信息,如下:

Router#sh controllers serial 0/0

()

buffer size 1524 HD unit 0, V.35 DTE cable

()

Router#sh controllers serial 0/1

()

buffer size 1524 HD unit 1, V.35 DCE cable

()


 

阅读(746) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~