zoukankan      html  css  js  c++  java
  • 常用路由命令

    以下内容是局域网路由器配置命令参考,家用路由器配置不在本文探讨之列。

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

    路由器的命令实际上难度和早期的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
    routerA(config-if)#no shutdown
    主机A的ip地址为 192.168.3.2
    255.255.255.0
    192.168.3.1
    配置路由器R2的名称和接口参数
    router>enable
    router#configure terminal
    router(config)#hostname routerB
    routerB(config)#interface fastethernet 0/0
    routerB(config-if)#ip address 192.168.2.2 255.255.255.0
    routerB(config-if)#no shutdown
    routerB (config-if)#exit
    routerB(config)# interface fastethernet 0/1
    routerB(config-if)#ip address 192.168.1.1 255.255.255.0
    主机B的ip地址为 192.168.1.2
    255.255.255.0
    192.168.1.1
    配置路由器R1的静态路由表
    routerA(config)#ip router 192.168.1.0 255.255.255.0 192.168.2.2
    配置路由器R2的静态路由表
    routerA(config)#ip router 192.168.3.0 255.255.255.0 192.168.2.1
    在R1和R2上配置默认路由
    routerA(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.2
    routerA(config)#ip classless
    routerB(config)#ip route 0.0.0.0 0.0.0.0 192.168.2.1
    routerB(config)#ip classless(支持可变长子网掩码、无类域间路由)
    在routerA和routerB上配置动态路由(RIP)
    routerA(config)#router rip
    routerA(config)#network 192.168.2.0
    routerA(config)#network 192.168.3.0
    routerB(config)# router rip
    routerB(config)#network 192.168.2.0
    routerB(config)#network 192.168.1.0

    17. 配置单臂路由
    router(config)# interface f0/0.1
    router(config-subif)# ip address 192.168.1.1 255.255.255.0
    router(config-subif)# encapsulation dot1q 1
    router(config-subif)# exit
    router(config)# interace f0/0.2
    router(config-subif)# ip address 192.168.2.1 255.255.255.0
    router(config-subif)# encapsulation dot1q 2
    router(config-subif)# exit
    router(config)# interface f0/0.3
    router(config-subif)# ip address 192.168.3.1 255.255.255.0
    router(config-subif)# encapsulation dot1q 3
    router(config-subif)# exit
    router(config)# interface f0/0
    router(config-if)# no shut

    系转载,原址:http://www.utosee.com/post/575.html

  • 相关阅读:
    P1182 数列分段Section II
    P1119 灾后重建
    P1133 教主的花园
    P1077 摆花
    P2002 消息扩散
    P2341 [HAOI2006]受欢迎的牛(tarjan+缩点)
    luoguP1726 上白泽慧音
    P1053 篝火晚会
    P2296 寻找道路
    P1156 垃圾陷阱
  • 原文地址:https://www.cnblogs.com/littleby/p/4564775.html
Copyright © 2011-2022 走看看