CISCO常用配置命令及参数

网络
CISCO的产品类型非常多,也是企业常常会选择的一个品牌。所以,作为运维人员,维护企业的网络,对于Cisco的产品的配置也要有所了解。

启动接口,分配IP地址:

  1. router> 
  2. router> enable  
  3. router#  
  4. router# configure terminal  
  5. router(config)#  
  6. router(config)# interface Type Port  
  7. router(config-if)# no shutdown  
  8. router(config-if)# ip address IP-Address Subnet-Mask  
  9. router(config-if)# ^z 

配置RIP路由协议:30秒更新一次

  1. router(config)# router rip  
  2. router(config-if)# network Network-Number <--通告标准A,B,C类网--> 
  3. router(config-if)# ^z 

配置IGRP路由协议:90秒更新一次

  1. router(config)# router igrp AS-Number <-- AS-Number范围1~65535--> 
  2. router(config-if)# network Network-Number <--通告标准A,B,C类网--> 
  3. router(config-if)# ^z 

配置Novell IPX路由协议:

  1. Novell RIP 60秒更新一次  
  2. router(config)# ipx routing [node address]  
  3. router(config)# ipx maximum-paths Paths <--设置负载平衡,范围1~512--> 
  4. router(config)# interface Type Port  
  5. router(config-if)# ipx network Network-Number [encapsulation encapsulation-type] [secondary] <--通告标准A,B,C类网--> 
  6. router(config-if)# ^z 

配置DDR:

  1. router(config)# dialer-list Group-Number protocol Protocol-Type permit [list ACL-Number]  
  2. router(config)# interface bri 0  
  3. router(config-if)# dialer-group Group-Number  
  4. router(config-if)# dialer map Protocol-Type Next-Hop-Address name Hostname Telphone-Number  
  5. router(config-if)# ^z 

配置ISDN:

  1. router(config)# isdn swith-type Swith-Type <--配置ISDN交换机类型,中国使用basic-net3--> 
  2. router(config-if)# ^z 

配置Frame Relay:

  1. router(config-if)# encapsulation frame-relay [cisco | ietf ]  
  2. router(config-if)# frame-relay lmi-type [ansi | cisco | q933a ]  
  3. router(config-if)# bandwidth kilobits  
  4. router(config-if)# frame-relay invers-arp [ Protocol ] [dlci ]  
  5. <--配置静态Invers ARP表:  
  6. router(config)# frame-relay Protocol Protocol-Address DLCI [ Broadcast ] [ ietf | cisco ] [ payload-compress | packet-by-packet ]  
  7. --> 
  8. <--设置Keepalive间隔:  
  9. router(config-if)# keepalive Number  
  10. --> 
  11. <--为本地接口指定DLCI:  
  12. router(config-if)# frame-lelay local-dlci Number  
  13. --> 
  14. <--子接口配置:  
  15. router(config-if)# interface Type Port.Subininterface-Number [ multipoint | point-to-point ]  
  16. router(config-subif)# ip unnumbered Interface  
  17. router(config-subif)# frame-lelay local-dlci Number  
  18. --> 
  19. router(config-if)# ^z 

配置标准ACL:

  1. router(config)# access-list Access-List-Number [ permit | deny ] source [ source-mask ] <-- Access-List-Number 范围:1~99标准ACL;100~199扩展ACL;800~899标准IPX ACL;900~999扩展IPX ACL;1000~1099 IPX SAP ACL;600~699Apple Talk ACL--> 
  2. router(config)# interface Type Port  
  3. router(config-if)# ip access-group Access-List-Number [ in | out ]  
  4. router(config-if)# ^z  
  5.  

配置扩展ACL:

  1. router(config)# access-list Access-List-Number [ permit | deny ] [ Protocol | Protocol-Number ] source source-wildcard [ Source-Port ] destination destination-wildcard [ Destination-Port ] [ established ]  
  2. router(config)# interface Type Port  
  3. router(config-if)# ip access-group Access-List-Number [ in | out ]  
  4. router(config-if)# ^z  
  5.  

配置命名ACL:

  1. router(config)# ip access-list [ standard | extended ] ACL-Name  
  2. router(config [ std- | ext- ] nacl)# [ permit | deny ] [ IP-Access-List-Test-Conditions ]  
  3. router(config [ std- | ext- ] nacl)# no [ permit | deny ] [ IP-Access-List-Test-Conditions ]  
  4. router(config [ std- | ext- ] nacl)# ^z  
  5. router(config)# interface Type Port  
  6. router(config-if)# ip access-group [ACL-Name | 1~199 ] [ in | out ]  
  7. router(config-if)# ^z 

#p#

配置DCE时钟:

  1. router# show controllers Type Port <--确定DCE接口--> 
  2. router(confin-if)# clock rate 64000 <--进入DCE接口设置时钟速率--> 
  3. router(config-if)# ^z 

配置PPP协议:

  1. router(config)# username Name password Set-Password-Here <--验证方建立数据库--> 
  2. router(config)# interface Type Port  
  3. router(config-if)# encapsulation ppp <--启动PPP协议--> 
  4. router(config-if)# ppp outhentication [ chap | chap pap | pap chap | pap ] <--选择PPP认证--> 
  5. router(config-if)# ppp pap sent-username Name password Password <--发送验证信息--> 
  6. router(config-if)# ^z 

PAP单向认证配置实例:

验证方:

  1. router-server(config)# username Client password 12345 <--验证方建立数据库--> 
  2. router-server(config)# interface serial 0  
  3. router-server(config-if)# encapsulation ppp  
  4. router-server(config-if)# ppp authentication pap <--选择使用PAP实现PPP认证--> 
  5. router-server(config-if)# ^z 

被验证方:

  1. router-client(config-if)# encapsulation ppp  
  2. router-client(config-if)# ppp pap sent-username Client password 12345 <--发送验证信息--> 
  3. router-client(config-if)# ^z 

PAP双向认证配置实例:

路由器 A:

  1. routerA(config)# username B password 12345  
  2. routerA(config)# interface serial 0  
  3. routerA(config-if)# encapsulation ppp  
  4. routerA(config-if)# ppp authentication pap  
  5. routerA(config-if)# ppp pap sent-username A password 54321  
  6. routerA(config-if)# ^z 

路由器 B:

  1. routerB(config)# username A password 54321  
  2. routerB(config)# interface serial 1  
  3. routerB(config-if)# encapsulation ppp  
  4. routerB(config-if)# ppp authentication pap  
  5. routerB(config-if)# ppp pap sent-username B password 12345  
  6. routerB(config-if)# ^z 

CHAP单向认证配置实例:

验证方:

  1. router-server(config)# username router-client password 12345  
  2. router-server(config)# interface serial 0  
  3. router-server(config-if)# encapsulation ppp  
  4. router-server(config-if)# ppp authentication chap  
  5. router-server(config-if)# ^z 

被验证方:

  1. router-client(config-if)# encapsulation ppp  
  2. router-client(config-if)# ppp authentication chap  
  3. router-client(config-if)# ppp chap hostname router-client  
  4. router-client(config-if)# ppp chap password 12345  
  5. router-client(config-if)# ^z 

CHAP双向认证配置实例:

路由器 A:

  1. routerA(config)# username routerB password 12345  
  2. routerA(config)# interface serial 0  
  3. routerA(config-if)# encapsulation ppp  
  4. routerA(config-if)# ppp authentication chap  
  5. routerA(config-if)# ppp chap hostname routerA  
  6. routerA(config-if)# ppp chap password 54321  
  7. routerA(config-if)# ^z 

路由器 B:

  1. routerB(config)# username routerA password 54321  
  2. routerB(config)# interface serial 1  
  3. routerB(config-if)# encapsulation ppp  
  4. routerB(config-if)# ppp authentication chap  
  5. routerB(config-if)# ppp chap hostname routerB  
  6. routerB(config-if)# ppp chap password 12345  
  7. routerB(config-if)# ^z 

#p#

Telnet使用:

  1. routerA# terminal monitor <--可以传回在远端主机执行Debug命令的结果--> 
  2. routerA# telnet IP-Address [ Router-Name ] <--Telnet到指定的地址或名字的主机--> 
  3. routerB# [ exit | logout ] <--退出Telnet--> 
  4. routerB# ++<6>再按 <--挂起Telnet--> 
  5. routerA# show sessions <--显示当前所有Telnet的信息,包括Connect-Number --> 
  6. routerA# Connect-Number <--返回指定的Telnet连接--> 
  7. routerA# disconnect IP-Address [ Router-Name ] <--断开指定地址或名字的主机的连接--> 
  8. routerA# show user <--显示Telnet到本机的连接信息--> 
  9. routerA# clear line [ 0 | 1 | 2 | 3 | 4 ] <--断开指定Telnet到本机的连接--> 

禁止任何Telnet到本机:

  1. router(config)# line vty 0 4  
  2. router(config-line)# access-class ACL-Number  
  3. router(config)# ^z 

设置主机名:

  1. router(config)# hostname Set-Hostname  
  2. router(config)# ^z  
  3. router(config)# ^z 

设置用户模式密码:

  1. router(config)# line console 0  
  2. router(config-line)# login  
  3. router(config-line)# password Set-Password  
  4. router(config-line)# ^z 

设置Telnet密码:

  1. router(config)# line vty 0 4  
  2. router(config-line)# login  
  3. router(config-line)# password Set-Password  
  4. router(config-line)# ^z 

设置特权模式密码:

  1. router(config)# enable password Set-Password <--不加密的密码,明码--> 
  2. router(config)# enable secret Set-Password <--经过加密的密码--> 
  3. router(config)# ^z 

给所有密码加密:

  1. router(config)# service password-ancryption Set-Password-Here  
  2. router(config)# no service password-ancryption <--取消加密--> 
  3. router(config)# ^z 

设置登录Banner:

  1. router(config)# banner motd 分隔符 Set-Banner-Information-Here 分隔符 <--前后分隔符一定要一致--> 

设置接口的描述信息:

  1. router(config-if)# description Set-Port-Information-Here  
  2. router(config)# ^z 

CDP的控制:

  1. router(config-if)# cdp enable <--在指定端口启用CDP,缺省--> 
  2. router(config-if)# no cdp enable <--在指定端口关闭CDP--> 
  3. router(config)# cdp run <--使所有端口启用CDP--> 
  4. router(config)# no cdp run <--使所有端口关闭CDP--> 

Ping的使用:

  1. router# ping IP-Address  
  2. router# ping <--扩展Ping命令--> 
  3. Protocol [ip]:[ Protocol-Type ] <--选择协议类型--> 
  4. Target IP address:IP-Address <--输入测试地址--> 
  5. Repeat count [5]: <--选择发送的ICMP包数量--> 
  6. Datagram size [100]: <--选择每个包的大小--> 
  7. Timeout in seconds [2]: <--设置每个包的超时时间--> 
  8. Extended commands [n]:y <--使用扩展Ping命令--> 
  9. Sweep range of sizes [n]: 

Tracke的使用:

  1. router# trace IP-Address [ Host-Name ] 

#p#

为Cisco 4000路由器指定媒体类型:

  1. router(config-if)# media-type 10baset <--使AUI(默认)失效,改为使用RJ-45--> 
  2. router(config-if)# ^z 

更改路由器启动顺序:

  1. router(config)# boot system flash IOS-FileName  
  2. router(config)# boot system tftp IOS-FileName TFTP-IP-Address  
  3. router(config)# boot system rom  
  4. router(config)# ^z 

修改寄存器数值:

  1. router(config)# config-register Value <--Cisco出厂默认Value=0x2102,Value范围:0x2100(进入ROM监视器),0x2101(使系统从ROM启动),0x2102~0x210F(使系统从NVRAM启动)。0x1=0x2101,从最小位开始改变--> 

在ROM监视器中更改寄存器数值:

  1. > o/r Value 

路由器密码的恢复:

冷关机,然后再开机并在60秒内按< Ctrl>+ 进入ROM监视器模式

  1. > o/r 0x2142 <--25xx型路由器--> 或 > confreg 0x2142 <--16xx型路由器--> 
  2. router> I  
  3. router> n  
  4. router> enable  
  5. router# copy startup-config running-config  
  6. router# configure terminal  
  7. router(config)# enable secret New-Password  
  8. router(config)# config-register 0x2102  
  9. router(config)# ^z  
  10. router# copy running-config startup-config  
  11. router# reload 

配置名称-主机入口:

  1. router(config)# ip host Set-Name [ TCP-Port-Number ] IP-Address [ IP-Address 2 ]...  
  2. router(config)# ^z 

定义DNS主机:

  1. router(config)# ip name-server Server-Address [ Server-Address 2 ]...  
  2. router(config)# ^z 

禁用DNS:

  1. router(config)# no ip domain-lookup  
  2. router(config)# ^z 

配置水平分割:

  1. router(config-if)# ip split-horizon  
  2. router(config-if)# no ip split-horizon  
  3. router(config-if)# ^z 

配置静态路由:

  1. router(config)# ip route IP-Address Subnet-Mask [ Next-Hop-Address | Local-Out-Port ] [Distace ]  
  2. <--Distance范围:1~255,相当于优先权,越小越好。RIP=120DSPF=110IGRP=100EIGRP=90--> 
  3. router(config)# ^z 

配置缺省路由:

  1. router(config)# ip defoult-network IP-Address <--动态缺省路由--> 
  2. router(config)# ip route 0.0.0.0 0.0.0.0 [ Next-Hop-Address | Local-Out-Port ] [Distace ] <--静态缺省路由--> 
  3. router(config)# ^z  

 

责任编辑:佟健 来源: NET130
相关推荐

2011-03-15 09:59:57

2011-03-15 09:02:01

IPtables常用命令

2011-07-21 11:51:58

Cisco ACE

2011-04-01 17:16:03

zabbix参数命令

2012-03-20 10:05:57

Cisco路由器路由器DNS

2009-11-26 09:56:39

Cisco路由器配置命交换机配置命令

2010-01-07 17:59:50

Ubuntu APT

2009-12-02 15:58:55

Cisco路由器配置命

2009-12-02 09:48:37

Cisco路由器配置命

2009-11-26 13:57:24

Cisco路由器命令

2021-02-05 07:48:06

Linux操作系统软件

2017-09-08 14:30:33

MongoDB安装操作命令

2013-08-23 10:11:01

生成树协议交换技术生成树

2009-06-09 11:31:35

思科路由器安装维护

2010-09-25 14:12:37

Cisco 3550配

2010-08-31 14:57:30

2010-07-26 09:22:05

Perl命令行

2010-07-15 09:27:25

Perl命令行

2010-08-03 08:52:57

配置

2009-08-11 10:34:41

linux中du命令参linux命令行参数linux命令行
点赞
收藏

51CTO技术栈公众号