关于路由器常见命令

写范文发表于:2023-04-01 20:31:43

路由器是我们常用的网络设备,在网络维护中其中十分重要的作用,但是您知道吗?路由器管理其实也是比较简单的,只要通过学习,您也可以成为网络高手,今天为大家分享一些路由器命令,在我们使用的时候,路由器命令都有哪些呢?今天的文章将给大家作详细的解答。

一、设置对话状态

设置对话状态是一台新路由器开机时自动进入的状态,在特权命令状态使用SETUP命令也可进入此状态,这时可通过对话方式对路由器进行设置。

二、>

路由器处于RXBOOT状态,在开机后60秒内按ctrl-break可进入此状态,这时路由器不能完成正常的功能,只能进行软件升级和手工引导。

三、router(config-if)#;router(config-line)#;router(config-router)#;…

路由器处于局部设置状态,这时可以设置路由器某个局部的参数。

四、router>

路由器处于用户命令状态,这时用户可以看路由器的连接状态,访问其它网络和主机,但不能看到和更改路由器的设置内容。

五、router(config)#

在router#提示符下键入configureterminal,出现提示符router(config)#,此时路由器处于全局设置状态,这时可以设置路由器的全局参数。

六、router#

在router>提示符下键入enable,路由器进入特权命令状态router#,这时不但可以执行所有的用户命令,还可以看到和更改路由器的设置内容。

网络管理员进行路由器的配置*作和命令大致上就是上面这些内容,希望对电脑爱好者与路由器学习者有所帮助,如果您觉得本文不错,记得收藏噢。

 

第2篇:cisco路由器常用命令

cisco路由器常用命令有哪些?下面内容由小编为大家介绍cisco路由器常用命令,供大家参考!

1、Switch>用户模式

2、Switch>enable进入特权模式

Switch#

3、Switch#configterminal进入全局模式

Switch(config)#

4、Switch(config)#interfacef0/1进入接口模式

Switch(config-if)#

5、Switch(config)#lineconsole0进入line模式

Switch(config-line)#

exit退回上层

end结束所有*作

6、Switch(config)#hostnameaaa配置主机名

7、switch#showrunning-config查看配置情况

8、Switch(config)#enablepassword111设置使能密码(明文)

9、Switch(config)#enablesecret111设置使能密码(密文)

Switch(config)#lineconsole0设置console密码

Switch(config-line)#password333

Switch(config-line)#login

10、Switch(config)#interfacevlan1

Switch(config-if)#ipaddress192.168.1.1255.255.255.0设置IP地址

Switch(config-if)#noshutdown

11、Switch(config)#ipdefault-gateway192.168.1.10设置网关

12、Switch#showmac-address-table查看MAC地址表

13、Switch#showcdpcdp全局配置信息

14、Switch#showcdpinterfacef0/1cdp接口配置信息

15、Switch#showcdptrafficcdp包的配置信息

16、Switch#showcdpneighborscdp邻居基本信息

17、Switch#showcdpneighborsdetailcdp邻居详细信息

Switch#showcdpneighborsentry

18、Switch#copyrunning-configstartup-config

19、Switch#erasestartup-config恢复出厂信息

Switch#reload重新加载

20、交换机密码恢复

*断开电源

*按住MODE键,加电(等待数秒)

*switch:出现此符号

*switch:flash_init初始化flash

*switch:dirflash:(查看文件,可省去)

*switch:renameconfig.textconfig.old改名

*switch:boot重启

*switch>enable进入特权

*switch#dirflash:(查看文件,可省去)

*switch#renameconfig.oldconfig.text改名

*switch#copyflash:config.textrunning-config复制到系统内

*switch#confitterminal进入全局模式

*switch(config)#enablepassword222设置新密码

21、switch#showvlan-swbrief查看vlan

22、switch#vlandatabase进入vlan模式

switch(vlan)#vlan20namebbb创建vlan并命名

23、switch(vlan)#novlan20删除vlan

24、添加端口到vlan(单个)

switch(config)#interfacef0/1进入接口模式

switch(config-if)#switchportaccessvlan10添加至vlan10

switch(config-if)#end退出

switch#showvlanbrief(id)验证vlan

switch(config)#showrunning-configinterfacef0/1(查看某接口)

25、添加端口到vlan(批量)

switch(config)#interfacerangef0/1-5

switch(config-if-range)#switchportaccessvlan10

26、switch(config)#interfacef0/1进入接口

switch(config-if)#switchportmodetrunk设置为trunk(永久)

switch(config-if)#switchportmodedynamicdesirable/auto(其它trunk)

switch(config-if)#switchporttrunkallowedvlanremove10移除vlan10)

switch(config-if)#switchporttrunkallowedvlanadd20添加vlan20

27、switch#showinterfacef0/1switchport查看接口模式

showipinterfacebrief

Switch#write保存交换机配置信息

 

第3篇:路由器配置命令

路由器是局域网络与广域网络(或城域网)相连的必备设备,也是网络管理员必备的技能之一。下面是小编收集的路由器配置命令,欢迎大家阅读!更多相关信息请关注相关栏目!

路由器的命令实际上难度和早期的dos*作系统或命令行的linux比较接近,但功能上要比以上*作系统单一很多。不同厂商的路由器命令有些许差别,但功能*的东西没有本质的差别。

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

1.进入特权模式enable

router>enable

router#

 2.进入全局配置模式configureterminal

router>enable

router#configureterminal

router(config)#

3.重命名hostnameroutera以routerA为例

router>enable

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#

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

router>enable

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#enablepasswordcisco

5.配置使能密码enablesecretciscolab以cicsolab为例

router>enable

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#enablesecretciscolab

6.进入路由器某一端口interfacefastether0/1

router>enable

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#interfacefastether0/1

routerA(config-if)#

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

router>enable

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#interfacefasteher0/1.1

7.设置端口ip地址信息

router>enable

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#interfacefastether0/1以1端口为例

routerA(config-if)#ipaddress192.168.1.1255.255.255.0配置交换机端口ip和子网掩码

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

routerA(config-if)#exit

8.查看命令show

router>enable

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

showcontrollersserial+编号查看串口类型

showiproute查看路由器的路由表

9.cdp相关命令

router>enable

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

showcdptraffic查看有关cdp包的统计信息

showcdpneighbors列出与设备相连的cisco设备

10.csico2600的密码恢复

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

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

rommon1>confreg0×2142

rommon2>reset

重新启动路由器后进入setup模式,选择“no”,退回到exec模式,此时路由器原有的配置仍然保存在startup-config中,为使路由器恢复密码后配置不变,则需要把startup-config中配置保存到running-config中,然后重新设置enable密码,并把配置寄存器的值改回0×2102。

router>enable

router#copystartup-configrunning-config

router#configureterminal

router(config)#enablepasswordcisco

router(config)#config-register0×2102

保存当前配置到startup-config,重新启动路由器。

router#copyrunning-configstartup-config

router#reload

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

router>en

router#configureterminal

router(config)#hostnamerouterA

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

routerA(config)#interfacefastether0/1

routerA(config-if)#ipaddress192.168.1.1255.255.255.0

routerA(config-if)#noshut

routerA(config-if)#exit

routerA(config)linevty04设置0-4个用户可以tel远程登陆

routerA(config-line)#password123

routerA(config-line)#login

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

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

router>en

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#bannermotd$Thisisaptechpany’router!Pleasedon’tchangetheconfigurationwithoutpermission!$

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

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

router>en

router#configureterminal

router(config)#hostnamerouterA

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

routerA(config-if)#descriptionthisisafastEtherportusedtoconnectingthepany’sintra!

14.配置超时

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

router>en

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#lineconsole0

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

15.配置串口参数

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

DCE配置:

router>en

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#interfaceserial0/0

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

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

routerA(config-if)#noshut

DTE配置:

router>en

router#configureterminal

router(config)#hostnamerouterB

routerB(config)#interfaceserial0/0

routerB(config-if)#noshut

16.静态路由的配置

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

router>enable

router#configureterminal

router(config)#hostnamerouterA

routerA(config)#interfacefastether0/0

routerA(config-if)#ipaddress192.168.2.1255.255.255.0

routerA(config-if)#noshutdown

routerA(config-if)#exit

routerA(config)#interfacefastether0/1

routerA(config-if)#ipaddress192.168.3.1255.255.255.0

routerA(config-if)#noshutdown

主机A的ip地址为192.168.3.2

255.255.255.0

192.168.3.1

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

router>enable

router#configureterminal

router(config)#hostnamerouterB

routerB(config)#interfacefastether0/0

routerB(config-if)#ipaddress192.168.2.2255.255.255.0

routerB(config-if)#noshutdown

routerB(config-if)#exit

routerB(config)#interfacefastether0/1

routerB(config-if)#ipaddress192.168.1.1255.255.255.0

主机B的ip地址为192.168.1.2

255.255.255.0

192.168.1.1

配置路由器R1的静态路由表

routerA(config)#iprouter192.168.1.0255.255.255.0192.168.2.2

配置路由器R2的静态路由表

routerA(config)#iprouter192.168.3.0255.255.255.0192.168.2.1

在R1和R2上配置默认路由

routerA(config)#iproute0.0.0.00.0.0.0192.168.2.2

routerA(config)#ipclassless

routerB(config)#iproute0.0.0.00.0.0.0192.168.2.1

routerB(config)#ipclassless(支持可变长子网掩码、无类域间路由)

在routerA和routerB上配置动态路由(RIP)

routerA(config)#routerrip

routerA(config)#work192.168.2.0

routerA(config)#work192.168.3.0

routerB(config)#routerrip

routerB(config)#work192.168.2.0

routerB(config)#work192.168.1.0

17.配置单臂路由

router(config)#interfacef0/0.1

router(config-subif)#ipaddress192.168.1.1255.255.255.0

router(config-subif)#encapsulationdot1q1

router(config-subif)#exit

router(config)#interacef0/0.2

router(config-subif)#ipaddress192.168.2.1255.255.255.0

router(config-subif)#encapsulationdot1q2

router(config-subif)#exit

router(config)#interfacef0/0.3

router(config-subif)#ipaddress192.168.3.1255.255.255.0

router(config-subif)#encapsulationdot1q3

router(config-subif)#exit

router(config)#interfacef0/0

router(config-if)#noshut