路由器配置命令

  • 格式:wps
  • 大小:35.50 KB
  • 文档页数:7

路由器配置命令

路由器是局域网络与广域网络(或城域网)相连的必备设备,也是网络管理员必备的技

能之一。

路由器的命令实际上难度和早期的dos操作系统或命令行的linux比较接近,但功能上

要比以上操作系统单一很多。不同厂商的路由器命令有些许差别,但功能性的东西没有本质

的差别。

以下是常用路由器配置命令。

1. 进入特权模式 enable

router > enable

router #

2. 进入全局配置模式 configure terminal

router > enable

router #configure terminal

router (config)#

3. 重命名 hostname routera 以routerA为例

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)#

4. 配置使能口令 enable password cisco 以cisco为例

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)# enable password cisco 5. 配置使能密码 enable secret ciscolab 以cicsolab为例

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)# enable secret ciscolab

6. 进入路由器某一端口 interface fastethernet 0/1

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)# interface fastethernet 0/1

routerA (config-if)#

进入路由器的某一子端口 interface fastethernet 0/1.1 以1端口的1子端口为例

router > enable

router #configure terminal

router(config)#hostname routerA

routerA (config)# interface fastehernet 0/1.1

7. 设置端口ip地址信息

router > enable

router #configure terminal

router(config)#hostname routerA

routerA(config)# interface fastethernet 0/1 以1端口为例

routerA (config-if)#ip address 192.168.1.1 255.255.255.0 配置交换机端口ip和子网

掩码

routerA (config-if)#no shut 启动此接口

routerA (config-if)#exit

8. 查看命令 show

router > enable

router # show version 察看系统中的所有版本信息

show controllers serial + 编号查看串口类型 show ip route 查看路由器的路由表

9. cdp相关命令

router > enable

router # show cdp 查看设备的cdp全局配置信息

show cdp traffic 查看有关cdp包的统计信息

show cdp neighbors 列出与设备相连的cisco设备

10. csico2600的密码恢复

重新启动路由器,在启动过程中按下ctrl+break键,使路由器进入rom monitor模式。

在提示符下输入命令修改配置寄存器的值,然后重新启动路由器。

rommon1>confreg 0×2142

rommon2>reset

重新启动路由器后进入setup模式,选择“no”,退回到exec模式,此时路由器原有的配置

仍然保存在startup-config中,为使路由器恢复密码后配置不变,则需要把startup-config

中配置保存到running-config中,然后重新设置enable密码,并把配置寄存器的值改回

0×2102。

router>enable

router#copy startup-config running-config

router#configure terminal

router(config)#enable password cisco

router(config)#config-register 0×2102

保存当前配置到startup(*系统启动项)-config , 重新启动路由器。

router #copy running-config startup-config

router #reload(*重新加载)

11. 路由器telnet远程登录设置

router>en

router #configure terminal

router (config)#hostname routerA

routerA (config)#enable password cisco 以cisco为特权模式密码

routerA (config)#interface fastethernet 0/1 routerA (config-if)#ip address 192.168.1.1 255.255.255.0

routerA (config-if)#no shut

routerA (config-if)#exit

routerA (config)line vty 0 4 设置0-4 个用户可以telnet远程登陆

routerA (config-line)#password 123

routerA (config-line)#login

12. 配置路由器的标识 banner $……………$

在全局配置的模式下利用“banner”命令可以配置路由器的提示信息,所有连接到路由器的终

端都会收到。

router>en

router #configure terminal

router (config)#hostname routerA

routerA(config)#banner motd $This is aptech company’ router ! Please don’t change

the configuration without permission!$

13. 配置接口标识 description ………

接口标识用于区分路由器的各个接口。用show run命令可以查看到这些标识。

router>en

router #configure terminal

router (config)#hostname routerA

routerA(config)#interface fastethernet 0/1 以0/1 接口为例

routerA(config-if)# description this is a fast Ethernet port used to connecting the

company’s intranet!

14. 配置超时

超时用于设置在多长时间没有对console进行配置,自动返回exec会话时间。默认为10分

钟。

router>en

router #configure terminal

router (config)#hostname routerA

routerA(config)#line console 0 routerA(config-line)#exec-timeout 0 0 第一个“0”代表分钟,第二个“0”代表秒

15. 配置串口参数

两台路由器通过串口连接需要一个做为DTE,一个做为DCE。DCE设备要向DTE设备提供时

钟频率和带宽。

DCE配置:

router>en

router #configure terminal

router (config)#hostname routerA

routerA(config)#interface serial 0/0

routerA(config-if)#clock rate 64000 提供时钟频率为64000

routerA(config-if)#bandwidth 64 提供带宽为64

routerA(config-if)#no shut

DTE配置:

router>en

router #configure terminal

router (config)#hostname routerB

routerB(config)#interface serial 0/0

routerB(config-if)#no shut

16. 静态路由的配置

配置路由器R1的名称和接口参数

router>enable

router#configure terminal

router(config)#hostname routerA

routerA(config)#interface fastethernet 0/0

routerA(config-if)#ip address 192.168.2.1 255.255.255.0

routerA(config-if)#no shutdown

routerA(config-if)#exit

routerA(config)# interface fastethernet 0/1

routerA(config-if)#ip address 192.168.3.1 255.255.255.0