思科路由器命令信息

一、模式命令。

首次开机,路由器设备需要初始化,这里我选择no。

Router>                         用户模式
Router>enable             进入特权模式
Router#                    特权模式  
Router#configure terminal          进入全局配置模式
Router(config)#               全局配置模式
ctrl +v shift ? 控制台输入?

二、基本命令

Router(config)#hostname RO1               配置路由器名称
Router(config)#no hostname 取消设置的用户名
RO1(config)#enable password 123456     配置登录密码
RO1(config)#enable secret 1234567      配置使用加密密码
RO1(config)#interface Ethernet 0/0 进入e0/0端口
RO1(config-if)#interface e0/0.10 进入e0/0.10子接口

RO1(config-if)#int e0/0 RO1(config-if)#ip address 192.168.1.1 255.255.255.0 设置端口IP地址

RO1(config-if)#no shutdown          启用端口
RO1(config-if)#shutdown 关闭端口
RO1(config-if)#exit 退出接口
RO1(config)#end   退出全局配置模式
RO1#write       保存设置   
RO1#disable                   退出特权模式
       

三、查看命令

  1.思科发现协议

    CDP ( Císco Discovery   Protocol)思科发现协议,通过cdp,我们可以获取相邻设备上的硬件和协议信息,这些信息可用于排除故障和记录网络信息。

    cdp 定时器:描述所有活动接口将CDP分组发送出去的时间间隔。

    cdp 保持时间:描述接收自相邻设备的cdp分组应当被当前设备保持的时间长度。

RO1#show cdp                  查看设备的cdp全局配置信息
RO1#show cdp interface e0/0               查看设备的e0/0端口的cdp配置信息
RO1#show cdp traffic                      查看有关cdp包统计信息
RO1#show cdp neighbors                    查看直接连接设备的相关信息

 RO1#cdp holdtime ?

  <10-255> Length of time (in sec) that receiver must keep this packet

  RO1#cdp timer ?

<5-254>

  2.基本查看命令  

RO1#show version                           查看系统中的所有版本信息
RO1#show running interface e0/0 查看接口配置的信息
RO1#show ip route        查看路由器的路由表
RO1#show log         查看路由器的log信息
RO1#show ip arp 查看设别学习到的arp信息
RO1#show arp detail               查看设别具体从哪个端口上学习到的
RO1#show ip interface brief       查看路由器IP地址信息
RO1#show int e0/0 查看端口详细
RO1#show cdp neighbors detail 用于搜集吡邻信息
RO1#show int st 查看路由器的接口是否up
RO1#show interfaces description       查看接口链接的描述信息

四、基本设置

RO1(config)#int e0/0                                           进入e0/0端口
RO1(config-if)#description miaoshu 对端口设置描述
RO1#sh run int e0/0 显示端口详细描述
RO1(config-if)#ip address 192.168.1.1 255.255.255.0 为e0/0端口配置IP地址为192.168.1.1
RO1(config)#ip default-gateway 192.168.1.1 配置网关
RO1(config-if)#no shutdown 启用端口
RO1(config)#line console 0 进入控制台口
RO1(config)#no ip domain lookup 关闭域名解析
RO1(config-line)#logging synchronous 开启信息同步
RO1(config-line)#exec-time 5 5 设置超时操作时间(分钟,秒)
RO1(config-line)#no exec-timeout 关闭会话超时
RO1(config-line)#line vty 0 4 设置允许0-4个用户可以远程登录
RO1(config-line)#login 要求口令验证
RO1(config-line)#password 123456 设置登录口令xx
RO1#reload 重新引导
RO1#wr er 恢复出厂设置
RO1#copy running-config startup-config  保存配置
RO1#copy running-config tftp 保存配置tftp
RO1#copy startup-config tftp 开机配置存到tftp
RO1#copy tftp startup-config 下载配置文件到tftp
RO1(config)#clock timezone GMT +8 设置时间时区
RO1#show clock                            查看时区
RO1#sh cdp neighbors                          查看各个接口链接,思科私有的
RO1(config)#lldp run 开启lldp协议(公用协议)
RO1#show lldp neighbors 显示lldp信息
RO1(config)#no ip routing 关闭路由功能

RO1#clock set 21:46:30 13 jun 2019 设置时间
RO1(config)#banner motd #
*************************************************
weclome to alan
*************************************************
# 为登录设置标语最后以#结束

五、静态路由

  1.配置静态路由

    配置出接口:非常依赖下一跳的代理ARP,关闭代理arp,就ping不通。

         配置下一跳:出发递归。

  2.静态路由最优:先写出接口,再写下一跳。

RO1(config)#ip route 2.0.0.0 255.255.255.0 e0/0            添加一条静态路由(目的网络,子网掩码(目的),下一跳地址)
RO1(config)#int loopback 1 启动一个环回口
RO1(config-if)#ip add 1.1.1.1 255.255.255.0 为环回口设置ip
RO1#traceroute ip 追踪两端中得每一跳(目标IP地址 ,源地址)
RO1#show ip route static 显示静态路由的配置

  3.ARP(Address Resolution Protocol)地址解析协议

    作用:将已知的ip地址解析为MAC地址。

  4.ARP请求报文,广播请求,单播更新。

  5.基本命令

RO1#show arp                                      查看ARP地址表映射
RO1(config-if)#no ip proxy-arp 关闭代理ARP 
RO1(config)#arp 192.168.1.3 0003.0003.0003.0003 arpa 绑定mac地址    
RO1(config)#ip classless  打开有类路由功能                  

   6.代理ARP:静态路由,只有出接口,没有下一跳的时候,会触发代理ARP。

   7.ARP特性:后到优先,多条路由情况,会导致次优。

六、RIP(Routing Information Protocol)路由协议

  1.Rfc( 思科官网文件编号):1058。

  2.距离矢量协议,传递路由,不知道路由拓扑。

  3.度量值:跳数。跳数超过15不可达。

  4.每30秒收敛一次,也可触发式更新。

  5.V1使用广播,V2使用组播,组播地址:224.0.0.9。

  6.管理距离120。

  7.RIPv1有类路由(不传递子网掩码),RIPv2无类路由(传递子网掩码,方便精确生成路由)。

  8.使用UDP协议传输。

  9.源目的端口号520。

  10.协议号:17。

  11.消息形式:请求消息,响应消息。

  12.默认支持等价负载均衡:4 ,最大支持6。

  13.RIP计时器

    更新计时器(update):30s更新路由表。

    无效计时器(invalid):180s不刷新则将该路由条目的度量值设置为16.

    刷新计时器(flush):默认240s,比无效计时器长60s。刷新后路由条目则删除。

    抑制计时器(Hold-down):180s。

  14.RIPv1

    1.有类路由协议  

    2.不支持变长子网掩码(VLSM)

    3.更新方式为广播

    4.不支持认证

    5.每个更新包最大支持25条路由条目

    6.路由表查询方式主类网段

    7.不支持不连续子网

  15.RIPv2

    1.无类路由协议  

    2.支持变长子网掩码(VLSM)

    3.路由更新方式为多播,目的地址为224.0.0.9

    4.支持明文及密文认证(思科私有)

    5.路由表查询机制是由小类=》大类(按位查询,最长匹配、精确匹配,先检查32位掩码的)

    6.支持不连续子网

  16.缺点:

    1.选路只看跳数,最大跳数为16

    2.收敛速度慢

    3.更新浪费网络资源

  17.基本命令

Router(config)#router rip                           进入rip配置模式
Router(config-router)#version 2                     设置版本(不设置版本,默认介于v1和v2之间)
Router(config-router)#no auto-summary               关闭自动汇总
Router(config-router)#network 2.2.2.2 宣告进组播分组(宣告C网段地址)
Router#show ip route  查看路由表
Router#show ip rip database 显示rip数据库中的信息
Router(config-router)#passive-interface e0/0 配置接口为被动接口
Router#show ip route

R 23.1.1.0 [120/1] via 12.1.1.2, 00:00:28, Ethernet0/0

备注:120表示管理地址,1表示开销,rip以跳数计算,1表示1跳。

    18.RIP路由环路。

七、OSPFv2(Open Shortest Path First)

  1.RFC(思科官网文件编号):2328

  2.链路状态路由协议:传递数据库,知道整个路由拓扑。

  3.度量值cost=10的8次方/宽带

  4.使用hello包建立邻居,10s利用组播发送一次,组播地址224.0.0.5

  5.管理距离:110.

  6.没有自动汇总功能

  7.无类路由

  8.OSPF协议号:89

  9.五种数据报文:Hello,DBD(Database Description),LSR(Link-State Requeest),LSU(Link-state Update),LACK(Link-State Acknowledgement)

  10.默认支持等价负载均衡4,最大支持16,只支持等价负载均衡。

  11.Router-ID:环回口地址/活动的物理接口最大值

  12.Hello作用:1.发现邻居,2.对一些数据的协商,3.保持邻居的Keeplive状态。选举DR、BDR,其他的称other()224.0.0.6。

  13Hello-interval=10s dead-interval=40s

  14.形成邻居的条件:区域号,认证类型,hello时间,死亡时间。

  15.OSPF的八种状态:Down,init,way,Exstart,Exchange,Loading,Full.

  16.DR/BDR选举

    1.查看优先级,列出能参选DR/BDR的和申明自己就是DR/BDR的。

    2.建立一个没有申明自己就是DR的子集。申明自己是DR的不能被选成BDR。

    3.在此子集中,优先级大的,router-id大的成为BDR。

    4.然后选择DR。若无声明自己是DR的话,则新选的BDR成为DR。

  17.基本命令

R1(config)#interface loopback 1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#ip ospf network point-to-point  /配置网络类型,不然会出现32主机路由
R1(config-if)#interface s1/1
R1(config-if)#ip address 10.1.1.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface s1/2
R1(config-if)#ip address 30.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#router ospf 100 /配置基本的 OSPF
R1(config-router)#distance 19 1.1.1.1 0.0.0.1 修改ospf的管理距离为19
R1(config-router)#router-id 1.1.1.1 /指定路由器 ID
R1(config-router)#network 10.0.0.0 0.0.0.255 area0 /通告直连路由建立邻居关系
R1(config-router)#network 30.0.0.0 0.0.0.255 area0 /通告直连路由建立邻居关系
R1(config-router)#network 1.1.1.0 0.0.0.255 area 0 /通告直连路由到骨干区域
R1(config-router)#exit

八、EIGRP

  1.协议号:88。

  2.组播地址:224.0.0.10。

  3.管理路径:内部(90),外部(170),汇总(5)。

  4.高级距离矢量协议

  5.快速收敛

  6.支持VLSM和不连续的子网

  7.局部更新

  8.支持多种网络层协议

  9.组播和单播代替广播更新

  10.灵活的网络设计

  11.组播喝广播代替广播更新

  12.在网络中任何地方实现手动汇总

  13.100%无环路的无类路由

  14.支持WANs and LANs

  15.可靠传输协议(RTP)保证EIGRP的包到达所有的邻居

  16.DUAL弥散更新算法

    Selects lowest-cost,loop free, paths to each destination

  17.协议独立模块(PDMs)

    EIGRP 支持IP,AppleTalk和Novell NetWare,每一种网络协议支持EIGRP都有 自己独立的模块。

  18.DUAL算法

    作用:无环路径,无环备用路径,可可立即使用,快速收敛,限定更新以使用最少带宽。

  19.计算开销的参考

    Bandwidth(带宽),Reliability(可靠性),Delay(延迟),Loading(负载),MTU(最大传输单元)。

  20.计算方法:256*[(10的7次方/链路最小接口带宽)+(链路延迟之和/10)]

  21.形成邻居的条件:AS号必须相同,K值必须匹配,认证相同

  22.基本配置命令

R1(config)#interface loopback 1
R1(config-if)#ip address 1.1.1.1 255.255.255.0
R1(config-if)#interface s1/1
R1(config-if)#ip address 10.1.1.2 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#interface s1/2
R1(config-if)#ip address 30.1.1.1 255.255.255.0
R1(config-if)#no shutdown
R1(config-if)#exit
R1(config)#router eigrp 100                        /配置基本的 EIGRP
R1(config-router)#network 10.0.0.0 0.0.0.255       /通告直连路由建立邻居关系
R1(config-router)#network 30.0.0.0 255.255.255.0   /通告直连路由建立邻居关系
R1(config-router)#network 1.1.1.0                  /通告直连路由到骨干区域
R1(config-router)#exit
Router#show run | sec eigrp 查看eigrp的配置信息
Router#show ip ei topology all-links 显示EIGRP拓扑表中的所有条目
R1(config-if)#bandwidth 100000 设置带宽
R1(config-if)#delay 1000 设置延迟
R1(config-router)#variance 15 Variance 值通过控制备用链路的Metric 值与FD 的倍数
关系来控制,设置非等价负载

 九、IS-IS(Intermediate System-Intermediate System)中间系统=中间系统

   1、IS-IS与OSPF对比

      相同:链路状态路由协议、算法SPF(LSDB同步一致)、 层次化、适用大型网络

      不同:ospf区域划分复杂,网络类型复杂

    2、基本命令

    

R2配置:
Router(config)#frame-relay switching 
Router(config)#ho FR-SW
FR-SW(config)#int s1/0
FR-SW(config-if)#encapsulation frame-relay
FR-SW(config-if)#frame-relay intf-type dce
FR-SW(config-if)#frame-relay route 103 interface s1/1 301
FR-SW(config-if)#no sh
FR-SW(config-if)#int s1/1
FR-SW(config-if)#encapsulation frame-relay
FR-SW(config-if)#frame-relay intf-type dce
FR-SW(config-if)#frame-relay route 301 interface s1/0 103
FR-SW(config-if)#no sh

R1配置:
Router(config)#int s1/0
Router(config-if)#encapsulation frame-relay
Router(config-if)#no sh

R3配置:
Router(config)#int s1/1
Router(config-if)#encapsulation frame-relay
Router(config-if)#no sh

R5配置(模拟终端PC):
Router(config)#no ip routing
Router(config)#clns net 49.0001.0000.0000.0005.00
Router(config)#int e0/0
Router(config-if)#no sh
Router(config-if)#clns enable                       开启clns

R4配置:
Router(config)#clns routing
Router(config)#router isis
Router(config-router)#log-adjacency-changes
Router(config-router)#net 49.0001.0000.0000.0004.00
Router(config-router)#int e0/0
Router(config-if)#clns enable
Router(config-if)#no sh
Router(config-if)#end
Router#show clns neighbors                  查看邻居

R3配置:
Router(config)#no ip routing

R4配置:
Router(config)#no ip routing

R3配置:
Router(config)#clns routing
Router(config)#router isis
Router(config-router)#log-adjacency-changes
Router(config-router)#net 49.0001.0000.0000.0003.00
Router(config-router)#int s1/0
Router(config)#int s1/0
Router(config-if)#clns router isis
Router(config-if)#no sh

R4配置:
Router(config)#int s1/0
Router(config-if)#clns router isis
Router(config-if)#do debug isis adj
Router(config-if)#do debug isis updat
Router(config-if)#no sh
Router(config-if)#do un all
Router#show clns protocol

 

      

 

 

       

          

posted @ 2020-02-18 10:55  人走茶良  阅读(2538)  评论(0编辑  收藏  举报
推荐:华为云