0

点击在新窗口中浏览此图片

登录方法 配置方法 基本命令 配置实例 故障排除

  登录方法

  1用Cisco路由器主控口OSOLE接VT100及兼容终端进行配置

  这是一种较为简便的配置方法,把终端与路由器可靠连接后,打开终端与路由器的电源,路由器的启动过程就会在终端上显示出来,当出现符号“>”时就可以在终端上对路由器进行配置了。如果终端上未显示路由器启动过程,可能是终端通讯端口参数配置不对,需重新配置。

  2通过Windows的终端仿真程序进行配置

  用CISCO随机带CONSOLE线,一端连在CISCO路由器的CONSOLE口,一端连在计算机的COM口。打开电脑,启动超级终端.为您的连接取个名字,比如CISCO_SETUP,下一步选定连接时用COM1,下一步选定第秒位数9600,数据位8,奇偶校验无,停止位1,数据流控制无.最后选确定。打开路由器电源,这时超级终端将出现路由器启动画面。

  3AUX口接MODEM,通过电话线与远方的终端或运行终端仿真软件的微机相连。

  4在TCP/IP网上通过Telnet进行配置

  通过网络上的主机运行telnet 145.1.1.5(路由器的IP地址),输入正确的口令就可以登录到网络上的路由器进行配置了。如出现了“password required,but none set”,则表明路由器的vty 04中未定义口令,需加入口令。

  5通过SSH安全登录进行配置

  在Cisco路由器产品系列中只有7200系列、7500系列和12000系列(GSR)等高端产品的IOS支持SSH。一般支持SSH的IOS版本文件名中都带有K3或者K4字样,K3 代表56bit SSH 加密,K4代表168bit SSH加密。目前Cisco的产品只支持SSH-1,还不支持SSH-2。下面以GSR 12008为例详细介绍SSH-1的配置方法:
  ① 配置hostname和ip domain-name:
  Router#configure terminal
  Router(config)#hostname TEST-GSR12008
  TEST-GSR12008(config)#ip domain-name jx.cn.net
  ② 配置登录用户名和密码(以本地认证为例):
  TEST-GSR12008(config)#username test password 0 test
  注:添加一个用户:test,口令:test
  TEST-GSR12008(config)#line vty 0 4
  TEST-GSR12008(config-line)#login local
  在这两部分做完以后,用show run命令就能够看到:
  hostname TEST-GSR12008
  !
  boot system flash gsr-k3p-mz.120-14.S.bin
  enable secret 5 $1$DMyW$gdSIOkCr7p8ytwcRwtnJG.
  enable password 7 094F47C31A0A
  !
  username test password 7 0835495D1D
  clock timezone PRC 16
  redundancy
  main-cpu
  auto-sync startup-config
  !
  !
  !
  !
  ip subnet-zero
  no ip finger
  ip domain-name jx.cn.net
  ip name-server 202.101.224.68
  ip name-server 202.101.226.68
  !
  ③ 配置SSH服务:
  TEST-GSR12008(config)#crypto key generate rsa
  The name for the keys will be: TEST-GSR12008.jx.cn.net
  注:SSH的关键字名就是hostname + . +ip domain-name
  Choose the size of the key modulus in the range of 360 to 2048 for your General Purpose Keys. Choosing a key modulus greater than 512 may take a few minutes.

  How many bits in the modulus [512]: 注:选择加密位数,用默认就行了
  Generating RSA keys ...
  [OK]

  TEST-GSR12008(config)#end
  TEST-GSR12008#write
  Building configuration...
  这时候用show run命令可以看到:
  ip subnet-zero
  no ip finger
  ip domain-name jx.cn.net
  ip name-server 202.101.224.68
  ip name-server 202.101.226.68
  ip ssh time-out 120
  ip ssh authentication-retries 3
  !
  用命令show ip ssh也能看到:
  SSH Enabled - version 1.5
  Authentication timeout: 120 secs; Authentication retries: 3
  现在SSH服务已经启动,如果需要停止SSH服务,用以下命令:
  TEST-GSR12008(config)#crypto key zeroize rsa
  ④设置SSH参数
  配置好了SSH之后,通过show run命令我们看到SSH默认的参数:超时限定为120秒,认证重试次数为3次,可以通过下面命令进行修改:
  TEST-GSR12008(config)#ip ssh {[time-out seconds]} | [authentication-retries interger]}
  如果要把超时限定改为180秒,则应该用:
  TEST-GSR12008(config)# ip ssh time-out 180
  如果要把重试次数改成5次,则应该用:
  TEST-GSR12008(config)# ip ssh authentication-retries 5
  这样,SSH已经在路由器上配置成功了,就能够通过SSH进行安全登录了。

  配置方法

  1 setup
  第一次安装时系统会自动进入DIALOG SETUP。依次回答路由器名称,加密超级登录密码,超级登录密码,远程登录密码 ,动态路由协议,各个接口的配置等。之后回答YES保存该配置。然后等2分钟,按回车数下。出现路由器名称。打入ENABLE命令,回答超级登录密码。出现路由器名称#。打入CONFIG TERMINAL配置路由器:
  NO SERVICE CONFIG
  NO IP DOMAIN-LOOKUP
  (进一步的配置)
  按CTRL-Z退出,出现路由器名称#。打入WRITE
  MEMORY保存配置。

 2 命令配置

 1.模式(Modes)
 Cisco IOS命令行界面是围绕模式(Modes)这个概念来进行组织的。在配置路由器的时候,你要在几个不同的模式之间进进出出,而所处模式决定所用的命令。每个模式都有一整套可用于该模式的命令,并且其中的某些命令只能用于该模式。在任何模式中,输入问号将显示用于该模式的命令列表。

 Router>?

 1.1 非特权模式。当你第一次连接路由器并提供口令(如果必要的话)时,进入EXEC模式,当前模式下只能查看有限的信息。输入show ? 将会显示所有用于当前模式的show命令。

 Router>show ?

 1.2特权模式。运行命令enable并提供口令之后,你就会进入特权模式。一旦你进入特权模式,你就有权访问所有的配置信息。

 Router#

 特权模式里有许多子模式。 所有子模式仍然以#号作结束,它们包含于特权模式之中。大多数模式都有自己的子模式。

 Router(参数)#

 2. 基本配置
 查看它当前的配置。运行命令enable进入特权模式,然后运行几个show命令来查看它们所显示的信息。

 Router#show interfaces
 Router#show ip protocols
 Router#show ip route
 Router#show ip arp

 当配置路由器时,你要进入各种子模式来设置选项,然后返回到父模式来显示命令结果。你还要返回到父模式来进入其它的子模式。返回父模式,按ctrl-z键。这时,你刚才运行的任何命令都会发生影响,并把你带回到父模式中。

 2.1 共用配置(config)
 配置路由器的任何特性,必须进入配置模式,这就是父模式的第一个子模式。在父模式中,运行 config命令。

 Router#config
 Router(config)#

 命名你的路由器:

 Router(config)#hostname ExampleName
 ExampleName(config)#

 指定路由器所用的DNS服务器:

 ExampleName(config)#ip name-server aa.bb.cc.dd
 ExampleName(config)#ctrl-Z
 ExampleName#

 为特权模式设置密码:

 ExampleName(config)#enable secret examplepassword
 ExampleName(config)#ctrl-Z
 ExampleName#

 在配置模式,运行几个不同的命令,然后按ctrl-Z键激活所有命令。每次你按下ctrl-Z键返回到父模式并提示:

 ExampleName#

 2.2 配置接口

 命名Cisco接口是直发的,个别接口由本约定指定:

 media type slot#/port#

 “介质类型”是指端口为诸如Ethernet、Token Ring、FDDI、串口等接口的介质类型。插槽数只适用于为你提供可以安装模块的插槽的路由器。这些模块包括几个特定介质的端口,7200系列就是一个例子。这些模块甚至是可热插拔的。你可以从插槽中移去一个模块并用一块不同的模块来代替它,而不必中断由安装在路由器里的其它模块所提供的服务。这些插槽在路由器中是被编号的。

 端口数涉及到的端口与该模块里的其它端口有关。编号方式是从左到右,所有编号都是从0开始,而不是1。

 例如,Cisco 7206是带有6个插槽的7200系列路由器。提到的一个接口是安装在第六插槽的Ethernet模块的第三个端口,它应是以太网6/2接口。因此,为了显示该接口的信息,你可以使用命令:

 ExampleName#show interface ethernet 6/2

 如果你的路由器没有插槽,如1600,那么接口名的组成只有:

 media type port#

 例如:

 ExampleName#show interface serial 0

 这里有一个用一个IP地址来配置一系列端口的例子:

 ExampleName#config
 ExampleName(config)#interface serial 1/1
 ExampleName(config-if)#ip address 192.168.155.2 255.255.255.0
 ExampleName(config-if)#no shutdown
 ExampleName(config-if)#ctrl-Z
 ExampleName#

 然后验证配置:

 ExampleName#show interface serial 1/1

 注意no shutdown命令。一个接口在正确配置及物理连接后,也许仍是“在管理上关掉”。在这种情形下,它不会起作用。引起一个接口在管理上关掉的命令是shutdown。

 ExampleName(config)#interface serial 1/1
 ExampleName(config-if)#shutdown
 ExampleName(config-if)#ctrl-Z
 ExampleName#show interface serial 1/1

 在Cisco IOS中,相反的情形或者删除任何命令的结果是简单地把no放在该命令的前面。例如,如果我们想取消已经赋给interface serial 1/1 的IP地址:

 ExampleName(config)#interface serail 1/1
 ExampleName(config-if)#no ip address 192.168.155.2 255.255.255.0
 ExampleName(config-if)ctrl-Z
 ExampleName#show interface serial 1/1

 2.3 路由
 在Cisco路由器上,IP路由是自动激活的。在你的路由器上,如果IP路由先前一直是关闭的话,你可以用命令ip routing返回到config模式中。

 ExampleName(config)#ip routing
 ExampleName(config)#ctrl-Z

 有两种主要的方式让路由器知道把包发送到什么地方,静态路由(static routes)和动态路由协议(dynamic routing protocol)来知悉路由。

 一个静态路由实例:

 ExampleName#config
 ExampleName(config)#ip route 172.16.0.0 255.255.255.0 192.168.150.1
 ExampleName(config)#ctrl-Z
 ExampleName#show ip route

  3用TFTP Server下载的配置文件进行配置

  UNIX、OS/2操作系统提供了TFTP服务器的功能,以OS/2为例,在OS/2的DOS窗口下运行ftfpd显示:
  IBM TCP/IP OS/2版本-TFTP Server版本19:50:56 ON dEC 7 1995已准备好

  通过某种方式登录到路由器,当出现“>”后,就可以进行配置了,下面是一个配置实例。

  Router>en

  password:abcdefg(特权用户口令)

  roture #copy ftfp runnig-config(拷贝TFTP服务器上的配置文件到路由
器的运行配置中)

  Host or network configuration file[host]?host

  Address of remote host[255.255.255.255]?145.1.1.1(主机的IP地址)

  145.1.1.1为运行TFTP的服务器,也是路由器配置文件所在的主机。

  如出现提示:“There are no usable interface configured for ip”表明
路由器的Ethernet 0(以太网口)未配置好。

  配置Ethernet 0:

  router#conf t

  router(config)#int e0

  router(config-if)ip address 145.1.1.5

  router(config-if)#no shutdown

  router(config-if)#exit

  router(config)#exit

  router#wr(保存到启动配置中)

  Name of configuration file[router-config]?2511(配置文件名)

  configure using 2511 from 145.1.1.1?[confirm]

  显示:

  Loading 2511 from 145.1.1.1(via Ethernet0)

  [ok-1553/32723 bytes]

  拷贝运行配置到启动配置文件NVRAM中:

  Router#copy runnig-config startup-config

  输入Router#i或重新开启路由器电源以重新启动路由器。

  备份运行配置到服务器中:

  router#copy runnig-config ftfp

  Remote host[]145.1.1.1

  Name of configuration file to write

  [router-config] 2511bf

  write file 2511bf on host 145.1.1.1?[confirm]

  显示:Writing 2511bf!![ok] 至此,路由器配置完成。

  4通过Ethernet上的SNMP网管工作站

 基本命令集

  一、 基本路由器的检验命令

 show version

 show processes

 show protocols

 show mem

 show ip route
 
 show startup-config

 show running-config

 show flash

 show interfaces

 二、 基本路由配置命令

 进入:config terminal/memory/network

 配置网络时常采用的命令:copy和load

 1. 标识:hostname 标识名

 2. 启动标识:banner 启动标识

 3. 接口:interface 端口号

 4. 密码:line 0 6

 login

 passwd 口令

 enable password/secret 口令

 5. 接口:

 1)配置端口

 interface 端口号

 clock rate 时钟速率(64000)/* 在串口中配置 */

 bandwidth 带宽(缺省56) /* 在串口中配置 */

 media-type 介质类型 /* 在以太网口上 */

 early-token release /* 在令牌环网口上 */

 ring-speed 16 /* 在令牌环网口上 */

 no shutdown

 write memory

 2)检验端口

 show interfaces

 show controllers

 6. 配置环境

 1) 引导方式

 boot system flash IOS-filename

 boot system tftp IOS-filename tftp-address

 boot system rom

 2) 配置Register值

 config-register 0x2102

 7. 查看邻居路由

 show cdp interface

 show cdp neighbors [detail]

 show cdp entry routerA

 8. IP Address 配置

 Ip address 网络地址 掩码

 Ip host 主机名 address

 Ip name-server 服务器地址1 服务器地址2 。。。

 Ip domain-lookup nsap

 Show hosts

 Ping 主机名/IP地址

 Trace 主机名/IP地址

 三、 IP 路由

 1. 静态路由

 ip routing

 ip route 目标网络号 掩码 端口号 [permanent]

 2. 缺省路由

 ip default-network 网络号

 3. 动态路由

 1) RIP配置

 Router rip

 Network 网络号

 Show ip route

 Show ip protocol

 Debug ip

 2) OSPF 配置

 Router ospf 进程号

 Redistribute 其它路由协议

 Network 端口网络 反掩码 area 区域号

 Area 区域号 range 网络号 掩码

 Area 区域号 default-cost 花销值

 Ip ospf priority number

 Ip ospf cost 花销值

 Show ip ospf database

 3) BGP 配置

 Router bgp 自治域号

 Redistribute 其它路由协议

 Network 网络号 /* 自治域内 */

 Aggregate-address 网络号 掩码 summary-only 汇总网络

 Neighbor 相邻网络号 remote-as 自治域号 /* 自治域间的网络 */

 四、 流量控制

 1) 被动端口

 passive interface 端口号

 2) 缺省路由

 ip default 网络号/端口网络

 3) 静态路由

 ip route 目标网络号 掩码 端口号

 4)ACL过滤表

 (全局上) access-list 访问号1 {permit|deny} 反掩码号 [ established]

 access-list 访问号2 {permit|deny} IP/TCP协议 源网络 目的网络

 操作符 参数

 (端口上)access-group 访问号 in|out

 distribute-list 访问号 in|out 端口号

 4) Null 0 interface

 Ip route address mask null 0

 五、 广义网配置

 1) PPP

 Ppp pap sent-usename 封装

 Ppp chap hostname

 Ppp chap password

 2)X.25

 encapsulation x25 [dce]

 x25 address

 x25 map 协议地址 /*SVC */

 x25 pvc pvc号 ip地址 x25地址 /*PVC */

 ip switching

 x25 route x.121地址 接口 x.121映射地址

 2) FrameRelay

 Frame-relay local-dlci IP网络号

 Frame-relay map 协议地址

 Frame-relay lmi-type ansi

Tags: , , | 分类:电脑网络 | 来源:本站原创 | 引用(0)
发表评论
表情
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
emotemotemotemotemot
打开HTML
打开UBB
打开表情
隐藏
记住我
昵称   密码   游客无需密码
网址   电邮   [注册]