思科(Cisco)路由器常用命令总结

视图模式介绍

  1. 普通视图router>
  2. 特权视图router# / 在普通模式下输入enable
  3. 全局视图router(config)#/ 在特权模式下输入configt
  4. 接口视图router(config-if)#/在全局模式下输入int 接口名称例如int s0 或 int e0
  5. 路由协议视图router ( config-route ) #/ 在全局模式下输入router 动态路由协议名称

1.路由器口令设置:

router>enable 进入特权模式router#config terminal 进入全局配置模式router(config)#hostname xxx 设置交换机的主机名router(config)#enable secret xxx 设置特权加密口令router(config)#enable password xxb 设置特权非密口令router(config)#line console 0 进入控制台口router(config-line)#line vty 0 4 进入虚拟终端router(config-line)#login 要求口令验证/使能可以登陆router(config-line)#password xx 设置登录口令xxrouter(config)#(Ctrl+z) 返回特权模式

router#exit 返回命令

1. router>enable         / 进入特权模式2. router#conft         / 进入全局配置模式3. router(config)#hostname  xxx/设置设备名称就好像给我们的计算机起个名字4. router(config)#enable password xxx /设置特权口令5.  router(config)#no ip  domain  lookup  /不允许路由器缺省使用DNS解析命令 6. router(config)#Service password-encryption/对所有在路由器上输入的口令进行暗文加密 7. router(config)#line  vty  0  4       /进入设置telnet服务模式router(config-line)#password   xxx    /设置  telnet 的密码router(config-line)#login       /使能可以登陆8. router(config)#line  con  0     /进入控制口的服务模式router(config-line)#password xxx   /要设置  console 的密码router(config-line)#login        /使能可以登陆

2.路由器配置:

router(config)#int s0/0 进入Serail接口router(config-if)#no shutdown 激活当前接口router(config-if)#clock rate 64000 设置同步时钟router(config-if)#ip address 设置IP地址router(config-if)#ip address second 设置第二个IProuter(config-if)#int f0/0.1 进入子接口router(config-subif.1)#ip address 设置子接口IProuter(config-subif.1)#encapsulation dot1q 绑定vlan中继协议router(config)#config-register 0x2142 跳过配置文件router(config)#config-register 0x2102 正常使用配置文件router#reload 重新引导
1. router(config)# int  s0/  进入接口配置模式serial 0 端口配置 (如果是模块化的路由器前面加上槽 位编号,例如serial0/0 代表这个路由器的0 槽位上的第一个接口)2.router(config-if)#ip add xxx.xxx.xxx.xxx   xxx.xxx.xxx.xxx/ 添加  ip 地址和掩码3.router(config-if)#enca   hdlc/ppp捆绑链路协议hdlc 或者  ppp 思科缺省串口封装的链路层协议 是 HDLC 所以在  show  run 配置的时候接口上的配置没有,如果要封装为别的链路层协议例如PPP/FR/X25就是看到接口下的enca ppp 或者 enca fr 4.router(config)#int  loopback/建立环回口(逻辑接口 )模拟不同的本机网段5.router(config-if)#ip  add  xxx.xxx.xxx.xxx   xxx.xxx.xxx.xxx/  添加ip  地址和掩码给环回口在物理接口 上配置了ip 地址后用no shut 启用这个物理接口反之可以用shutdown 管理性的关闭接口

3.路由器文件操作:

router#copy running-config startup-config 保存配置router#copy running-config tftp 保存配置到tftprouter#copy startup-config tftp 开机配置存到tftprouter#copy tftp flash: 下传文件到flashrouter#copy tftp startup-config 下载配置文件

ROM状态:

Ctrl+Break 进入ROM监控状态rommon>confreg 0x2142 跳过配置文件rommon>confreg 0x2102 恢复配置文件rommon>reset 重新引导rommon>copy xmodem: flash: 从console传输文件rommon>IP_ADDRESS=10.65.1.2 设置路由器IPrommon>IP_SUBNET_MASK=255.255.0.0 设置路由器掩码rommon>TFTP_SERVER=10.65.1.1 指定TFTP服务器IPrommon>TFTP_FILE=c2600.bin 指定下载的文件rommon>tftpdnld 从tftp下载rommon>dir flash: 查看闪存内容rommon>boot 引导IOS

4.静态路由:

ip route 命令格式

router(config)#ip  route  xxx.xxx.xxx.xxx  xxx.xxx.xxx.xxx  下一跳或自己的接口
router(config)#ip route 2.0.0.0 255.0.0.0 1.1.1.2 静态路由举例router(config)#ip route 0.0.0.0 0.0.0.0 1.1.1.2 默认路由举例

5.缺省路由

router(config)#ip route 0.0.0.0 0.0.0.0 s0添加缺省路由

6.动态路由:

router(config)#ip routing 启动路由转发router(config)#router rip 启动RIP路由协议。router(config-router)#network 设置发布路由。router(config-router)#negihbor 点对点帧中继用。

动态路由rip 协议

router(config)#router  rip    /启动 rip 协议router(config-router)#network  xxx.xxx.xxx.xxx   /宣告自己的网段router(config-router)#version  2   /转 换为 rip2 版本router(config-router)#noauto-summary  /关闭自动汇总功能,ripV2才有作用router(config-router)#passive-in 接 口 名 / 启 动 本 路 由 器 的 那 个 接 口 为 被 动 接 口router(config-router)#neixxx.xxx.xxx.xxx/广播转单播报文,指定邻居的接 ip

动态路由eigrp 协议

router(config)#router eigrp  xxx    /启动  eigrp 协议router(config-router)#network  xxx.xxx.xxx.xxx   /宣告自己的网段router(config-router)#variance   xxx     /调整倍数因子,使用不等价的负载均衡eigrp 协议router(config-router)#noauto-summary  /关闭自动汇总功能ospf 协议

动态路由ospf协议

router(config)router  ospf  xxx  /启动协议router(config-router)network xxx.xxx.xxx.xxx  xxx.xxx.xxx.xxx(反掩码)area   xxx/ 宣告自己的接口 或网段在ospf 的区域中可以把不同接口宣告在不同区域中

7.帧中继命令:

router(config)#frame-relay switching 使能帧中继交换router(config-s0)#encapsulation frame-relay 使能帧中继router(config-s0)#fram-relay lmi-type cisco 设置管理类型router(config-s0)#frame-relay intf-type DCE 设置为DCErouter(config-s0)#frame-relay dlci 16router(config-s0)#frame-relay local-dlci 20 设置虚电路号router(config-s0)#frame-relay interface-dlci 16router(config)#log-adjacency-changes 记录邻接变化router(config)#int s0/0.1 point-to-point 设置子接口点对点router#show frame pvc 显示永久虚电路router#show frame map 显示映射

8.基本访问控制列表:

router(config)#access-list permit|denyrouter(config)#interface ;default:deny anyrouter(config-if)#ip access-group in|out ;defaultut例1:
router(config)#access-list 1 deny host 10.65.1.1router(config)#access-list 1 permit anyrouter(config)#int f0/0router(config-if)#ip access-group 4 in例2:
router(config)#access-list 4 permit 10.8.1.1router(config)#access-list 4 deny 10.8.1.0 0.0.0.255router(config)#access-list 4 permit 10.8.0.0 0.0.255.255router(config)#access-list 4 deny 10.0.0.0 0.255.255.255router(config)#access-list 4 permit anyrouter(config)#int f0/1router(config-if)#ip access-group 4 in

扩展访问控制列表:

access-list permit|deny icmp [type]access-list permit|deny tcp [port]例1:
router(config)#access-list 101 deny icmp any 10.64.0.2 0.0.0.0 echorouter(config)#access-list 101 permit ip any anyrouter(config)#int s0/0router(config-if)#ip access-group 101 in例2:
router(config)#access-list 102 deny tcp any 10.65.0.2 0.0.0.0 eq 80router(config)#access-list 102 permit ip any anyrouter(config)#interface s0/1router(config-if)#ip access-group 102 out

删除访问控制例表:

router(config)#no access-list 102router(config-if)#no ip access-group 101 in

路由器的nat配置

Router(config-if)#ip nat inside 当前接口指定为内部接口Router(config-if)#ip nat outside 当前接口指定为外部接口Router(config)#ip nat inside source static [p] <私有IP><公网IP> [port]Router(config)#ip nat inside source static 10.65.1.2 60.1.1.1Router(config)#ip nat inside source static tcp 10.65.1.3 80 60.1.1.1 80Router(config)#ip nat pool p1 60.1.1.1 60.1.1.20 255.255.255.0Router(config)#ip nat inside source list 1 pool p1Router(config)#ip nat inside destination list 2 pool p2Router(config)#ip nat inside source list 2 interface s0/0 overloadRouter(config)#ip nat pool p2 10.65.1.2 10.65.1.4 255.255.255.0 type rotaryRouter#show ip nat translationrotary 参数是轮流的意思,地址池中的IP轮流与NAT分配的地址匹配。overload参数用于PAT 将内部IP映射到一个公网IP不同的端口上。

外部网关协议配置

routerA(config)#router bgp 100routerA(config-router)#network 19.0.0.0routerA(config-router)#neighbor 8.1.1.2 remote-as 200

配置PPP验证:

RouterA(config)#username passwordRouterA(config)#int s0RouterA(config-if)#ppp authentication {chap|pap}

9.路由器子接口封装为8021Q (补充)

Encapsulation .1Q,2是子接口号标识,这里是示范,可以随意设置。

10.保存当前修改/运行的配置:

1.router#write/将 RAM 中的当前配置存储到NVRAM 中,下次路由器启动就是执行保存的配置2.router#Copy   running-config    startup-config/命令与write 效果一样

11.一般常用命令

1.exit命令

router(config-if)#exitrouter(config)# router(config-router)#exitrouter(config)#router(config-line)#exitrouter(config)# router(config)#exitrouter#exit 命令 / 从接口、协议、line 等视图模式下退回到全局配置模式,或从全局配置模式退回到特权模式

2.end命令

router(config-if)#end router(config-router)#endrouter(config-line)#endrouter#end 命令 / 从任何视图直接回到特权模式

3.logout

router#Logout/ 退出当前路由器登陆模式相对与windows 的注销

4.reload命令

router#reload/  重新启动路由器 (热启动)冷启动就是关闭路由器再打开电源开关

5.show 命令

特权模式下:router#show ip route/查看当前的路由表router#cleariproute*/清楚当前的路由表 router#show ip protocol/查看当前路由器运行的动态路由协议情况router#show ip int brief/查看 当前的路由器的接口ip地址启用情况router#show running-config/查看当前运行配置 router#show startup-config/查看启动配置router#debug ip pack/  打开  ip 报文的调试 router#terminal  monitor/  输出到终端上显示调试信息router#show ip eigrp neighbors/查看 eigrp 协议的邻居表router#show ip eigrp topology/查看 eigrp 协议 的拓朴表router#show ip eigrp interface/查  看当然路由器运行eigrp协议的  接口情况router#show ip ospf neighbor/查看当前路由器的ospf 协议的邻居表router#show ip ospf interface/查看当然路由器运行ospf协议的接口情况router#clear ip ospf process/  清楚当然路由器ospf 协议的进程router#Show interfaces/  显示设置在路由器和访问服务器上所有接口的统计信息. 显示路由器 上配置的所有接口的状态router#Show interfaces serial/  显示关于一个串口的信息router#Show ip interface/列出一个接口的IP 信息和状态的小结,列出接口的状态和全局参数

思科(Cisco)交换机路由器命令大全相关推荐

  1. CISCO交换机配置命令大全

    CISCO交换机配置命令大全 1.在基于IOS的交换机上设置主机名/系统名: switch(config)# hostname hostname 在基于CLI的交换机上设置主机名/系统名: switc ...

  2. Cisco(思科)交换机路由器命令集合1

    目录 交换机和路由器的基本命令: 计算机网命令: 设置ip地址: 文件操作相关命令: 交换机与路由器显示(查看)命令汇总: 交换机和路由器的基本命令: 命令 作用 switch>enable 进 ...

  3. 思科交换机配置命令大全!

    1. 交换机支持的命令: 交换机基本状态: switch: :ROM状态, 路由器是rommon> hostname> :用户模式 hostname# :特权模式 hostname(con ...

  4. 华为路由器命令大全(字典查询)

    华 为 路 由 器 命 令 大 全 删除设备配置  reset saved-configuration 重启  reboot 看当前配置文件  display current-configuratio ...

  5. 思科cisco交换机如何查找环路及解决方法

    思科cisco交换机如何查找环路及解决方法 如何能直观快速的判断cisco交换机是否出现了环路?并快速定位交换机环路的位置呢?这成为一个难题? 环路查看目前没有什么最好的办法,只能通过一些信息直观查看 ...

  6. CISCO交换机配置命令及释义

    CISCO交换机配置命令及释义 1.设置交换机名称 switch(config)#hostname DSHD DSHD(config)# 2.设置交换机管理IP地址 switch(config)#in ...

  7. 《通用版CISCO交换机配置命令及释义》——【全面、通用,含部分功能的注释】

    CISCO交换机配置命令及释义 1.设置交换机名称 switch(config)#hostname DSHD DSHD(config)# 2.设置交换机管理IP地址 switch(config)#in ...

  8. 思科Cisco交换机的基本命令

    一.设备的工作模式 1.用户模式 Switch> 可以查看交换机的基本简单信息,且不能做任何修改配置! 2.特权模式 Switch> enable Switch# 可以查看所有配置,且不能 ...

  9. cisco链路聚合 不均衡_思科CISCO交换机间链路聚合端口聚合实现方法详解

    本文讲述了思科CISCO交换机间链路聚合端口聚合实现方法.分享给大家供大家参考,具体如下: [CISCO] 交换机间链路聚合端口聚合 端口通道( port channel ) 是一种聚合多个物理接口 ...

  10. 华为交换机路由器命令手册(企业级设备使用文档)

    title: 华为交换机路由器命令手册(企业级设备使用文档) date: 2020-04-08 13:53:49 tags: [network,huawei] category: 网络 简介 华为交换 ...

最新文章

  1. python获取进程编号(目的、获取当前进程编号、根据编号杀死指定进程号、获取当前父进程编号)
  2. 做个有产品意识的工程师
  3. 用shape结合selector实现点击效果
  4. 设计模式复习-工厂方法模式
  5. idea JDK安装与配置
  6. Scrum 冲刺 第一日
  7. ZigBee与智慧家居-ZigBee方案
  8. VxWorks动态加载
  9. virtualbox macos_MacOS 终于可以完美使用 Podman 了!
  10. C语言程序care用法,词汇精选:care的用法和辨析
  11. python定位文件位置_在Python中定位文件位置
  12. (网络收藏)WIKI
  13. 动易SiteFactory数据采集模块
  14. 【面经】字节AI Lab-NLP算法热乎面经
  15. 《Fortran 95 程序设计》阅读笔记一
  16. 华为交换机最常用的基础命令汇总大全,赠最新版华为S系列交换机调试配置指南
  17. 数据治理之元数据管理实践
  18. jQuery实现下拉菜单[代码+详细讲解+效果图]
  19. matlab 加上划线,latex 上划线
  20. 谭浩强c语言第五版视频,张子枫平胸

热门文章

  1. InputStream 、FileInputStream、InputStreamReader 、BufferedReader的区别
  2. 【Python】使用torrentParser1.03对单文件torrent的分析结果
  3. oracle含有特殊字符查询,Oracle特殊字符查询
  4. dimens文件生成器
  5. 路由器管理页面html,电脑怎么进入路由器设置界面_怎么登录路由器管理界面?-192路由网...
  6. 从k-\epsilon到k-\omega
  7. 网卡的HWADDR和MACADDR的区别?
  8. office 复合文档数据结构解析“初探”
  9. 2021-06-01-HPC-performance-test
  10. SAS硬盘优缺点概述