1.普通视图router> 

  2.特权视图router# / 在普通模式下输入enable

  3.全局视图router(config)#/ 在特权模式下输入configt

  4.接口视图router(config-if)#/在全局模式下输入int 接口名称例如int s0 或 int e0 

 5.路由协议视图router ( config-route ) #/ 在全局模式下输入router 动态路由协议名称








1


基本配置:



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


接口配置


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    


/建立环回口(逻辑接口 )模拟不同的本机网段



router(config-if)#ip  add  xxx.xxx.xxx.xxx   xxx.xxx.xxx.xxx


/  添加ip  地址和掩码给环回口在物理接口 上配置了ip 地址后用no shut 启用这个物理接口反之可以用shutdown 管理性的关闭接口








3


路由配置




1.静态路由

router(config)#ip  route  xxx.xxx.xxx.xxx  xxx.xxx.xxx.xxx  下一跳或自己的接口

2.缺省路由

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

3.动态路由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

4.动态路由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 协议

5.动态路由ospf协议

router(config)router  ospf  xxx  /启动协议

router(config-router)network xxx.xxx.xxx.xxx  xxx.xxx.xxx.xxx(反掩码)area   xxx

/ 宣告自己的接口 或网段在ospf 的区域中可以把不同接口宣告在不同区域中








4


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


1.router#write

/将 RAM 中的当前配置存储到NVRAM 中,下次路由器启动就是执行保存的配置

2.router#Copy   running-config    startup-config   

 /命令与write 效果一样








5


一般常用命令


1.exit命令


router(config-if)#exit


router(config)# router


(config-router)#exit


router(config)#


router(config-line)#exit


router(config)# router


(config)#exit


router#


exit 命令 / 从接口、协议、line 等视图模式下退回到全局配置模式,或从全局配置模式退回到特权模式


2.end命令


router(config-if)#end 


router(config-router)#end


router(config-line)#end


router#


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 信息和状态的小结,列出接口的状态和全局参数






ONE


更多精彩推荐,请关注我们


思科CISCO常用命令汇总_串口



本文分享自微信公众号 - 释然IT杂谈