|
路由器常用命令介绍
http://www.wotby.com 大众网
命令编辑:
ctrl+A 移动到命令行首
ctrl+B 向前移动一个字符位置
ctrl+E 移动到命令行尾
ctrl+F 向后移动一个字符位置
ctrl+P 上一个命令
1、设置时间: clock set hh:mm:ss day month year //
day-----January February march
2 显示时间:show clock
3、查看最近输入的命令:show history
4、设置历史命令记录大小:terminal history size A //
A---记录大小0-256
5、查看NVRAM里面的配置文件:show startup-config
6、保存配置到NVRAM中: copy run start or copy running-config startup-config
7、删除配置文件:erase start
8、重启路由器;reload
9、设置路由器名
hostname AAAA
AAAA---路由器的名称
10、设置IP地址
config t
int e0
ip address ip-address subnet-mask
no shutdown
conf t
int to0
ip address ip-address subnet-mask
ring speed 16
no shutdown
11、端口描述
conf t
int s0
description DKKKD
DKKKD为端口的描述内容
12、bandwidth 64
13、clock rate 64000
14、设置交换机的网关
ip default-gateway ip-address
15、查看路由表
en
show ip route
16、设置静态路由
conf t
ip route ip address sub-mask next-step
ip route 172.16.20.2 255.255.255.0 172.16.40.1
ip route 0.0.0.0 0.0.0.0 218.6.92.1(网关地址)
17、删除路由
no ip router ip address sub-mask next-step
18、设置默认路由
conf t
ip route 0.0.0.0 0.0.0.0 next-step
ip classless //此命令说明使用默认路由
19、RIP路由配置
conf t
router rip \进入RIP配置环境
network ip-address
no router rip //删除RIP路由
19、配置IGRP路由
router igrp 10
network subnet-num
1.帮助在IOS操作中,无论任何状态和位置,都可以键入“?”得到系统的帮助。
2.改变命令状态进入特权命令状态 enable
退出特权命令状态 disable
进入设置对话状态 setup
进入全局设置状态 configterminal
退出全局设置状态 end
进入端口设置状态 interfacetypeslot/number
进入子端口设置状态 interfacetypenumber.Subinterface[point-to-point|multipoint]
进入线路设置状态 linetypeslot/number
进入路由设置状态 routerprotocol
退出局部设置状态 exit
3.显示命令
查看版本及引导信息 showversion
查看运行设置 showrunning-config
查看开机设置 showstartup-config
显示端口信息 showinterfacetypeslot/number
显示路由信息 showiprouter
4拷贝命令
用于IOS及CONFIG的备份和升级
5.网络命令
登录远程主机 telnethostname/IPaddress
网络侦测 pinghostname/IPaddress
路由跟踪 tracehostname/IPaddress
6.基本设置命令
全局设置 configterminal
设置访问用户密码 usernameusernamepasswordpassword
设置特权密码 enablesecretpassword
设置路由器名 hostnamename
设置静态路由 iproutedestinationsubnet-masknext-hop
启动IPX路由 ipxrouting
端口设置 interfacetypeslot/number
设置IP地址 ipaddressaddresssubnet-mask
设置IPX网络 ipxnetworknetwork
激活端口 noshutdown
物理线路设置 linetypenumber
启动登录进程 login[local|tacacsserver]
设置登录密码 passwordpassword
在路由器上设置一个主机名
Router(config)# hostname Router-Branch-23
在路由器上配置一个域名,这样它就知道所处哪个DNS域中。举例如下
Router-Branch-23(config)# ip domain name TechRepublic.com
禁用Web服务
Cisco路由器还在缺省情况下启用了Web服务,它是一个安全风险。如果你不打算使用它,最好将它关闭。举例如下:
Router(config)# no ip http server
配置命令别名
许多网络管理员都知道在路由器上配置命令的缩写(也就是别名)。举例如下:
Router(config)# alias exec s sh run
这就是说你现在可以输入s,而不必输入完整的show running-configuration命令。
不让日志消息打扰你的配置过程
Cisco IOS中另一个我认为的小毛病就是在我配置路由器时,控制台界面就不断弹出日志消息(可能是控制台端口,AUX端口或VTY端口)。要预 防这一点,你可以这样做。
所以在每一条端口线路上,我使用日志同步命令。举例如下:
Router(config)# line con 0
Router(config-line)# logging synchronous
Router(config)# line aux 0
Router(config-line)# logging synchronous
Router(config)# line vty 0 4
Router(config-line)# logging synchronous
在路由器缓冲区或系统日志服务器中记录系统消息
捕获路由器的错误和事件以及监视控制台是解决问题的关键。默认情况下,路由器不会将缓冲的事件记录发送到路由器内存中。
然而,你可以配置路由器将缓冲的事件记录发送到内存。举例如下:
Router(config)# logging buffered 16384
你还可以将路由器事件发送到一个系统日志服务器。由于该服务器处在路由器外部,就有一个附加的优点:即使路由器断电也会保留事件记录
配置IP地址
IP地址配置任务包括以下各项:
接口IP地址配置(必须)
ip address ip-address mask //设置一个接口的IP地址
no ip address ip-address mask //取消一个接口的IP地址
ip address ip-address mask secondary //可以为一个接口配置多个IP地址。
地址解析协议(ARP)配置(可选)
arp ip-address mac-address arp-type //定义静态ARP
arp ip-address mac-address arp-type alias //响应该IP地址的ARP请求
no arp ip-address //取消静态ARP
arp {arpa | snap} //设置ARP封装类型,默认状态下,ARP封装为Ethernet II类型
no arp {arpa | snap} //取消ARP封装类型设置
arp timeout seconds //配置ARP超时时间Red-Giant(config-if)#
no arp timeout //恢复缺省配置
ip proxy-arp //启用代理ARP功能
no ip proxy-arp //关闭代理ARP功能
主机名到IP地址映射配置(可选)
ip host host-name [Telnet-port] ip-address [ip-address2…ip-address8] //手工配置主机名和IP地址映射Red-Giant(config)#
no ip host //删除手工配置
ip name-server ip-address [ip-address2…ip-address 6] //配置DNS服务器,最多可以有6个
ip domain-lookup //启动DNS进行域名解析
no ip name –server //删除DNS服务器
no ip domain-lookup //关闭DNS域名解析
ip domain-name domain-name //定义缺省域名
ip domain-list domain-name //增加域名到域名列表中
no ip domain-name domain-name //取消缺省域名
no ip domain-list domain-name //删除域名列表中的某个域名
关闭IP路由(可选)
no ip routing //关闭IP路由功能
ip routing //启动IP路由功能
ip default-gateway ip-address //配置缺省网关,只有关闭IP路由后,缺省网关才有效
no ip default-gateway //取消缺省网关
广播包处理配置(可选)
配置静态路由
ip route network mask {ip-address | interface-type interface-number } [distance] [tag tag] [permanent] //配置静态路由Router(config)#
no ip route network mask //删除静态路由
访问控制列表(access control lists),也称为访问列表(access lists),俗称为防火墙,是通过定义一些准则对经过路由器接口上的数据报文进行控制:转发或丢弃。访问列表准则可以针对数据流的源地址、目标地址、上层协议或其他信息。RGNOS允许用户使用以下几类访问列表:1).基本访问列表;2).基于时间的访问列表
配置基本访问列表
基本访问列表的配置包括以下两步:1).定义基本访问列表;2).将基本访问列表应用于特定接口。
access-list access-list-number {permit|deny} […...] //定义访问列表(必须)
interface type number //选择要应用访问列表的接口(必须)
ip access-group access-list-number {in|out}// 将访问列表应用特定接口(必须)
实例:
interface FastEthernet0
ip address 192.168.12.1 255.255.255.0
!
interface FastEthernet1
ip address 2.2.2.2 255.255.255.0
ip access-group 101 in
ip access-group 101 out
!
ip route 0.0.0.0 0.0.0.0 FastEthernet1 2.2.2.1
!
access-list 101 permit tcp 192.168.12.0 0.0.0.255 any eq telnet
access-list 101 deny icmp 192.168.12.0 0.0.0.255 any
access-list 101 deny ip 2.2.2.0 0.0.0.255 any
下面是一个基于时间的ACL的配置示例:
interface FastEthernet 0
ip access-group 101 in
!
access-list 101 permit ip any any time-range xyz
!
time-range xyz
absolute start 12:00 1 January 2001
思科路由器基本配置
1、接口,分配IP地址:
router> enable
router# configure terminal
router(config)# interface Type Port
router(config-if)# no shutdown
router(config-if)# ip address IP-Address Subnet-Mask
router(config-if)# ^z
2、RIP路由协议:30秒更新一次
router(config)# router rip
router(config-if)# network Network-Number <--通告标准A,B,C类网-->
router(config-if)# ^z
3、IGRP路由协议:90秒更新一次
router(config)# router igrp AS-Number <-- AS-Number范围1~65535-->
router(config-if)# network Network-Number <--通告标准A,B,C类网-->
router(config-if)# ^z
4、Novell IPX路由协议:Novell RIP 60秒更新一次
router(config)# ipx routing [node address]
router(config)# ipx maximum-paths Paths <--设置负载平衡,范围1~512-->
router(config)# interface Type Port
router(config-if)# ipx network Network-Number [encapsulation encapsulation-type] [secondary] <--通告标准A,B,C类网-->
router(config-if)# ^z
5、DDR:
router(config)# dialer-list Group-Number protocol Protocol-Type permit [list ACL-Number]
router(config)# interface bri 0
router(config-if)# dialer-group Group-Number
router(config-if)# dialer map Protocol-Type Next-Hop-Address name Hostname Telphone-Number
router(config-if)# ^z
6、ISDN:
router(config)# isdn swith-type Swith-Type <--配置ISDN交换机类型,中国使用basic-net3-->
router(config-if)# ^z
7、Frame Relay:
router(config-if)# encapsulation frame-relay [cisco | ietf ]
router(config-if)# frame-relay lmi-type [ansi | cisco | q933a ]
router(config-if)# bandwidth kilobits
router(config-if)# frame-relay invers-arp [ Protocol ] [dlci ]
8、置静态Invers ARP表:
router(config)# frame-relay Protocol Protocol-Address DLCI [ Broadcast ] [ ietf | cisco ] [ payload-compress | packet-by-packet ]
9、Keepalive间隔:
router(config-if)# keepalive Number
10、接口指定DLCI:
router(config-if)# frame-lelay local-dlci Number
11、子接口配置:
router(config-if)# interface Type Port.Subininterface-Number [ multipoint | point-to-point ]
router(config-subif)# ip unnumbered Interface
router(config-subif)# frame-lelay local-dlci Number
-->
router(config-if)# ^z
12、配置标准ACL:
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-->
router(config)# interface Type Port
router(config-if)# ip access-group Access-List-Number [ in | out ]
router(config-if)# ^z
13、配置扩展ACL:
router(config)# access-list Access-List-Number [ permit | deny ] [ Protocol | Protocol-Number ] source source-wildcard [ Source-Port ] destination destination-wildcard [ Destination-Port ] [ established ]
router(config)# interface Type Port
router(config-if)# ip access-group Access-List-Number [ in | out ]
router(config-if)# ^z
14、配置命名ACL:
router(config)# ip access-list [ standard | extended ] ACL-Name
router(config [ std- | ext- ] nacl)# [ permit | deny ] [ IP-Access-List-Test-Conditions ]
router(config [ std- | ext- ] nacl)# no [ permit | deny ] [ IP-Access-List-Test-Conditions ]
router(config [ std- | ext- ] nacl)# ^z
router(config)# interface Type Port
router(config-if)# ip access-group [ACL-Name | 1~199 ] [ in | out ]
router(config-if)# ^z
15、配置DCE时钟:
router# show controllers Type Port <--确定DCE接口-->
router(confin-if)# clock rate 64000 <--进入DCE接口设置时钟速率-->
router(config-if)# ^z
16、配置PPP协议:
router(config)# username Name password Set-Password-Here <--验证方建立数据库-->
router(config)# interface Type Port
router(config-if)# encapsulation ppp <--启动PPP协议-->
router(config-if)# ppp outhentication [ chap | chap pap | pap chap | pap ] <--选择PPP认证-->
router(config-if)# ppp pap sent-username Name password Password <--发送验证信息-->
router(config-if)# ^zPAP单向认证配置实例:
验证方:
router-server(config)# username Client password 12345 <--验证方建立数据库-->
router-server(config)# interface serial 0
router-server(config-if)# encapsulation ppp
router-server(config-if)# ppp authentication pap <--选择使用PAP实现PPP认证-->
router-server(config-if)# ^z
被验证方:
router-client(config-if)# encapsulation ppp
router-client(config-if)# ppp pap sent-username Client password 12345 <--发送验证信息-->
router-client(config-if)# ^zPAP双向认证配置实例:
路由器 A:
routerA(config)# username B password 12345
routerA(config)# interface serial 0
routerA(config-if)# encapsulation ppp
routerA(config-if)# ppp authentication pap
routerA(config-if)# ppp pap sent-username A password 54321
routerA(config-if)# ^z
路由器 B:
routerB(config)# username A password 54321
routerB(config)# interface serial 1
routerB(config-if)# encapsulation ppp
routerB(config-if)# ppp authentication pap
routerB(config-if)# ppp pap sent-username B password 12345
routerB(config-if)# ^z
CHAP单向认证配置实例:
验证方:
router-server(config)# username router-client password 12345
router-server(config)# interface serial 0
router-server(config-if)# encapsulation ppp
router-server(config-if)# ppp authentication chap
router-server(config-if)# ^z
被验证方:
router-client(config-if)# encapsulation ppp
router-client(config-if)# ppp authentication chap
router-client(config-if)# ppp chap hostname router-client
router-client(config-if)# ppp chap password 12345
router-client(config-if)# ^zCHAP双向认证配置实例:
路由器 A:
routerA(config)# username routerB password 12345
routerA(config)# interface serial 0
routerA(config-if)# encapsulation ppp
routerA(config-if)# ppp authentication chap
routerA(config-if)# ppp chap hostname routerArouterA(config-if)# ppp chap password 54321
routerA(config-if)# ^z
路由器 B:
routerB(config)# username routerA password 54321
routerB(config)# interface serial 1
routerB(config-if)# encapsulation ppp
routerB(config-if)# ppp authentication chap
routerB(config-if)# ppp chap hostname routerB
routerB(config-if)# ppp chap password 12345
routerB(config-if)# ^z
Telnet使用:
routerA# terminal monitor <--可以传回在远端主机执行Debug命令的结果-->
routerA# telnet IP-Address [ Router-Name ] <--Telnet到指定的地址或名字的主机-->
routerB# [ exit | logout ] <--退出Telnet-->
routerB# ++<6>再按 <--挂起Telnet-->
routerA# show sessions <--显示当前所有Telnet的信息,包括Connect-Number -->
routerA# Connect-Number <--返回指定的Telnet连接-->
routerA# disconnect IP-Address [ Router-Name ] <--断开指定地址或名字的主机的连接-->
routerA# show user <--显示Telnet到本机的连接信息-->
routerA# clear line [ 0 | 1 | 2 | 3 | 4 ] <--断开指定Telnet到本机的连接-->
禁止任何Telnet到本机:
router(config)# line vty 0 4
router(config-line)# access-class ACL-Number
router(config)# ^z
设置登录Banner:
router(config)# banner motd 分隔符 Set-Banner-Information-Here 分隔符 <--前后分隔符一定要一致-->
设置接口的描述信息:
router(config-if)# descrīption Set-Port-Information-Here
router(config)# ^z
CDP的控制:
router(config-if)# cdp enable <--在指定端口启用CDP,缺省-->
router(config-if)# no cdp enable <--在指定端口关闭CDP-->
router(config)# cdp run <--使所有端口启用CDP-->
router(config)# no cdp run <--使所有端口关闭CDP-->
Ping的使用:
router# ping IP-Address
router# ping <--扩展Ping命令-->
Protocol [ip]:[ Protocol-Type ] <--选择协议类型-->
Target IP address:IP-Address <--输入测试地址-->
Repeat count [5]: <--选择发送的ICMP包数量-->
Datagram size [100]: <--选择每个包的大小-->
Timeout in seconds [2]: <--设置每个包的超时时间-->
Extended commands [n]:y <--使用扩展Ping命令-->
Sweep range of sizes [n]:
Tracke的使用:
router# trace IP-Address [ Host-Name ]
为Cisco 4000路由器指定媒体类型:
router(config-if)# media-type 10baset <--使AUI(默认)失效,改为使用RJ-45-->
router(config-if)# ^z
更改路由器启动顺序:
router(config)# boot system flash IOS-FileName
router(config)# boot system tftp IOS-FileName TFTP-IP-Address
router(config)# boot system rom
router(config)# ^z
修改寄存器数值:
router(config)# config-register value <--Cisco出厂默认value=0x2102,value范围:0x2100(进入ROM监视器),0x2101(使系统从ROM启动),0x2102~0x210F(使系统从NVRAM启动)。0x1=0x2101,从最小位开始改变-->
在ROM监视器中更改寄存器数值:
> o/r value路由器密码的恢复:
冷关机,然后再开机并在60秒内按< Ctrl>+进入ROM监视器模式
> o/r 0x2142 <--25xx型路由器--> 或 > confreg 0x2142 <--16xx型路由器-->
router> I
router> n
router> enable
router# copy startup-config running-config
router# configure terminal
router(config)# enable secret New-Password
router(config)# config-register 0x2102
router(config)# ^z
router# copy running-config startup-config
router# reload
配置名称-主机入口:
router(config)# ip host Set-Name [ TCP-Port-Number ] IP-Address [ IP-Address 2 ]...
router(config)# ^z
定义DNS主机:
router(config)# ip name-server Server-Address [ Server-Address 2 ]...
router(config)# ^z
禁用DNS:
router(config)# no ip domain-lookup
router(config)# ^z
配置水平分割:
router(config-if)# ip split-horizon
router(config-if)# no ip split-horizon
router(config-if)# ^z
配置静态路由:
router(config)# ip route IP-Address Subnet-Mask [ Next-Hop-Address | Local-Out-Port ] [Distace ]
<--Distance范围:1~255,相当于优先权,越小越好。RIP=120;DSPF=110;IGRP=100;EIGRP=90-->
router(config)# ^z
配置缺省路由:
router(config)# ip defoult-network IP-Address <--动态缺省路由-->
router(config)# ip route 0.0.0.0 0.0.0.0 [ Next-Hop-Address | Local-Out-Port ] [Distace ] <--静态缺省路由-->
router(config)# ^z
其它命令:
router# show version
router# show running-config
router# show startup-config
router# show flash
router# show interface [ Type Port ]
router# show buffers
router# show protocol
router# show mem
router# show stacks
router# show processes
router# show cdp entry [ Device-Name ] <--显示指定邻居三层信息-->
router# show cdp neighbors
router# show cdp neighbors detail <---显示所有邻居三层信息->
router# show ip router
router# show ipx router
router# show host
router# show ip protocol
router# show ip interface Type Port
router# show ipx interface Type Port
router# show ipx servers
router# show ipx traffic
router# show access-lists [ ACL-Number ]
router# show isdn status
router# show dialer <--查看ISDN拨号信息-->
router# show isdn active
router# show frame-relay pvc
router# show frame-relay map
router# show frame-relay lmi
router# erase startup-config
router# reload
router# setup
router# copy running-config startup-config
router# copy startup-config running-config
router# copy tftp running-config
router# copy running-config tftp
router# debug ipx routing activity
router# debug ipx sap
router# debug isdn q921
router# debug isdn q931
router# debug dialer
router# debug ip rip
router# clear interface bri [ 0 | 1 | 2 ]
查看它当前的配置。运行命令enable进入特权模式,然后运行几个show命令来查看它们所显示的信息。
Router#show interfaces
Router#show ip protocols
Router#show ip route
Router#show ip arp
用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
二、 基本路由配置命令
1)配置端口
interface 端口号
clock rate 时钟速率(64000)/* 在串口中配置 */
bandwidth 带宽(缺省56) /* 在串口中配置 */
media-type 介质类型 /* 在以太网口上 */
early-token release /* 在令牌环网口上 */
ring-speed 16 /* 在令牌环网口上 */
write memory
2)检验端口
show interfaces
show controllers
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
Cisco路由器的基本配置 作者: 来源:? 阅读 484 人次?,?2006-5-19 16:18:00?
随着IT业的飞速发展,Cisco路由器被广泛应用于各行各业,本文将从基础配置入手,简单介绍一下Cisco路由器的配置方法。
一、配置以太网端口 # conf t
CISCO路由器基本配置(一)
1、用show命令查看路由器
show clock 查看路由器当时时钟;
show history 查看曾经输入到路由器当中的最后10条命令;
show users 查看当时登录到路由器中的用户;
show protocols 查看路由器整个接口使用的三层协议信息;
show interface 查看接口的状态;
show flash 查看flash的大小和已经使用的大小
show version 查看路由器硬件平台,软件版本,开机时间,NVRAM和flash的大小,已经
register的值,还有接口和接口的具体数量;
#show running-config 查看RAM内存中的配置,RAM中的配置掉电后会丢失
#show startup-config 查看NVRAM中的配置,NVRAM中的配置掉电后不会丢
失;
#show ip interface brief 查看端口状态的概述;
#show ip interface [端口] 查看端口详细状态;
#show interface [端口] 查看端口的运行产数和端口的状态;
#show ip route 查看路由表;
#show ip protocols 查看路由协议;
2、路由器的基本配置
(config)#hostname R1 定义路由器名称为R1
(config)#enable password boson 定义明文密码为boson
(config)#enable secret cisco 定义加密密码为cisco,定义了加密密码后,明文密码自
动失效
(config)#ip subnet-zero 在无类网络环境下,使‘0'子网可以使用;
(config)#ip classless 使路由器处于无类网络环境;
(config)#banner motd z 回车, 输入标语,z :这个命令的作用是给路由器定义进入路由
器时的提示语。
#copy running-config startup-config 把RAM内存中的配置保存到NVRAM中;
#erase startup-config 删除NVRAM中的配置;
#reload 重新启动路由器,会提示保存配置;
3、配置接口
if#ip address 192.168.100.1 255.255.255.0 配置接口地址
if#no shutdown 激活接口;
if#shutdown 关闭接口;
if#description this interface to R2 接口说明;
#show ip interface brief 查看端口状态概述;
#show ip interface [端口] 查看端口的详细状态;
#show interface [端口] 查看端口的运行产数和端口状态;
4、ARP管理
#show arp 查看arp表;
#clear arp 清除arp表;
5、建立主机列表
(config)#ip host R2 10.1.1.2 255.255.255.0 建立主机列表
(config)#show hosts 查看主机列表;
6、建立静态路由
(config)#ip route 172.16.10.0 255.255.255.0 10.1.1.1 建立静态路由;
(config)#ip route 0.0.0.0 0.0.0.0 192.168.100.1 建立默认路由;
7、配置RIP路由协议
a、(config)#router rip 启用rip路由协议;
b、(config)#network 10.1.1.0 在10.1.1.0网段上发布rip路由协议;因为
rip是有类网络协议,所以不用添加掩码,即使添上掩码,rip版本1也会按照有
类网络去发布网段,即发布10.0.0.0
c、(config)#network 172.16.10.0 在172.16.10.0网段上发布rip路由协议;
d、#show ip route 查看路由表;
e、#show ip protocols 查看路由协议;
8、配置IGRP路由协议
a、(config)#router igrp 200
b、(config)#network 10.1.1.0 在10.1.1.0网段上发布igrp路由协议;因
为igrp是有类网络协议,所以不用添加掩码,即使添上掩码,igrp版本1也会按
照有类网络去发布网段,即发布10.0.0.0
c、#show ip route 查看路由表;
d、#show ip protocols 查看路由协议;
9、配置PPP链路封装协议
a、(config)#hostname R1 定义主机名,需要和对端定义的username
一致;
b、R1(config)#enable secret test 定义加密密码,需要和对端定义的
username密码一种;
c、(config)#username R2 password cisco 定义对端的用户名和密码;需要和对端的
主机名和密码一致;
d、(config)#hostname R2
e、R2(config)#enable secret cisco
f、(config)#username R1 password test
g、(if)#encapsulation ppp 在链路上封装ppp链路协议;
h、(if)#ppp authentication chap 启用chap认证方式,也可以启用pap认证认
证方式,chap是密文传送,pap是明文传送;
10、保存配置到TFTP服务器中
a、#copy run tftp 或copy start tftp
address or name of remote host []?192.168.100.1
Destination filename []? config_file
把配置保存在TFTP服务器中,首先在pc机上启用TFTP服务器,保证pc机和路由器网络的
连同性;
b、#copy tftp run 或copy tftp start
把配置从tftp服务器上传到路由器上,过程和下传配置相似;
11、配置ISDN
username RTB password 91lab.com 定义用户名和密码,如果你要拨号到ISP,那么即是
ISP提供给你的用户名和密码。
isdn switch-type basic-ni 定义ISDN交换机类型,可以在全局模式,也可以在
bri0接口模式,中国好像是basic-net3
int bri0
desc http://www.91lab.com
ip add x.x.x.x x.x.x.x 定义ISDN地址,如果ISP没有给你公网IP地址,这里
应该写0.0.0.0 0.0.0.0
isdn spid1 xxxxxx 电信给的和线路相关的产数,在中国好像不用配置
encapsulation ppp 封装二层认证协议,
ppp authentication chap 选择认证方式;
no peer neighbor-route 阻止对端形成的主机路由
no cdp enable 阻止cdp协议,不然容易引起拨号;
dialer map ip x.x.x.x name RTB broadcast 把拨号和IP地址,用户名关联起来;
dialer idle 300 空闲300秒时即断开线路;
dialer load 51 out 当流量达到51/255时启用第二条通道;
dialer-g 1 在接口上用拨号组把拨号列表和接口关联起来;
dialer-list 1 protocol ip permit 定义拨号列表,也可以和访问控制列表关联起来一
起使用,这样更灵活,如下:
还有1点就是,在写dialer list的时候,可以把关键字permit换成list xxx,即:
dialer-list 1 protocol ip list 101(调用ACL 101)
access-l 101 per ip any 166.166.0.0 0.0.255.255 any
show isdn status 查看isdn状态;
|