用户模式:R1>enable //进入特权模式
特权模式R1#conf t //进入全局模式
全局模式:R1(config)#exit //退出至上一级
R1(config)#end //退回特权模式
接口模式:R1(config-if)#
子接口模式R1(config-subif)#
行模式R1(config-line)#
查看命令:?
补全命令:Tab
删除命令 :no
配置enbale密码:
- R1(config)#hostname CCIE //修改主机名
- CCIE(config)#enable password sovand //设置明文密码
- CCIE(config)#enable secret sovand //设置密文密码
console口配置:
- R1(config)#line console 0
- R1(config-line)#password cisco //设置登入密码
- R1(config-line)#login //密码生效
加密配置命令:
- R1(config)#username cisco password sovand
- R1(config)#service password-encryption //加密所有口令,不可逆
vty链路配置:
- R2(config)#line vty 0 4 //开通远程登录虚拟通道,0-4个通道
- R2(config-line)#password cisco
- R2(config-line)#login
telnet远程登录设备:
- R1#telnet 12.12.12.2 //远程登录12.12.12.2这台设备
- R1#show sessions //检查telnet连接
- R1#show users //检查telnet用户
- ctrl+shift+6 X //关闭telnet
配置接口IP地址:
- R1(config)#int 【接口类型+端口号】 //进入接口
- R1(config-if)#ip add 【IP地址】 【子网掩码】 //配置IP地址
- R1(config-if)#no sh //打开接口
远程测试设备连通性:R1#ping 【IP地址】
R1#traceroute 【IP地址】
查看路由配置:R1#show running-config
保存配置:R1#wr
重新加载路由器:R1#reload
查询ARP缓存:R1#show ip arp
查看一、二层状态:R1#show int
查看路由表:R1#show ip route
查看三层接口信息:R1#show ip int
查看总接口信息:R1#show ip int b
查看接口协议:R1#show protocols
查看物流接口信息:R1#show controllers
查看版本信息:R1#show version
查看邻居设备:R1#show cdp neighbors
排错命令:debug、show processes
静态路由配置:R1(config)#ip route 【目标网段网络号】 【掩码】 【转发接口】/【下一跳地址】
默认路由:R1(config)#0.0.0.0/0 【出接口】/【下一跳】
回环口的配置
- R1(config)#int loopback1 //创建了回环口1,并进入接口模式
- R1(config-if)#ip add 【IP地址】【子网掩码】
PC配置:模拟器中用路由器模拟PC,所以要关闭路由功能 才能配置网关
- PC1#conf t
- PC1(config)#no ip routing //关闭路由功能,才能配置网关
- PC1(config)#ip default-gateway 【网关】 //配置网关ip地址,直连路由器的接口ip地址
- PC1(config)#int 【接口】
- PC1(config-if)#ip add 【IP地址】【子网掩码】
- PC1(config-if)#no sh
RIP配置:
- R1(config)#router rip //全局模式下,用该命令开启RIP,进入RIP配置进程
- R1(config-router)#version 2 //修改RIP版本为v2,默认是版本v1
- R1(config-router)#network 172.16.0.0 //用来通告直连网段,以直连网段所属的主类网段来通告,效果是,network出来的网段会更新给直连路由器,RIP更新报文只会往network的接口上更新
- R1(config-router)#network 172.17.0.0
- R1(config-router)#no auto-summary //关闭自动汇总功能,默认v2版本是开启自动汇总
- R1(config-if)#ip summary-address rip 172.16.0.0 255.255.252.0
//手动汇总:在更新路由条目的出接口上配置,配置完后更新的条目就会被汇总成所配置的网段信息
- R1#clear ip route * //手动刷新路由表,不需要等待路由老化时间
- R1#debug ip rip //显示出所有的rip报文。关闭方法:no debug ip rip ,undebug all
RIP认证的配置:双方配置的认证,不管是认证方式,还是认证密码一定要一致,否则不能学习到对方的路由信息
- R2(config)#key chain 【goktech】 //定义密钥集合名字为本地定义,比如:goktech
- R2(config-keychain)#key 1 //密钥编号,双方一定要一致
- R2(config-keychain-key)#key-string 【cisco】 //密码,双方也要一致,比如为:cisco
- R2(config-keychain-key)#exit
- R2(config-keychain)#exit
- R2(config)#int f0/1 //认证的开始需要在接口下完成,影响是这个接口下的直连路由器
- R2(config-if)#ip rip authentication mode 【md5/text】 //设置认证的类型,有明文(text)和md5两种认证可选
- R2(config-if)#ip rip authentication key-chain 【goktech】 //调用密钥集合,调用的是之前定义的goktech
OSPF配置
- R1(config)#router ospf 1
- R1(config-router)#network 10.1.1.1 0.0.0.0 area 0
//反掩码,0置为要跟前面的对应前缀数值相同,1置为的不匹配
- R1#show ip ospf neighbor //查看邻居(邻接)关系
- R1(config)#router ospf 1
- R1(config-router)#router-id 200.1.1.1
//配置router-id,本路由器还没有形成ospf邻居前,router-id是可以随时修改的,直接生效。 如果已经形成了邻居关系,修改router-id,必须重启进程来重置所有的本地邻居关系,以新的router-id去建立邻居关系,才能生效。
- R2#clear ip ospf process //重置ospf进程的命令
- Reset ALL OSPF processes? [no]: y
- R2(config)#int f0/0
- R2(config-if)#ip ospf priority 10
//修改接口优先级,影响DR/BDR选举。注意不抢占的特点,需要重新建立邻居关系才会有影响
点到点路由:
- R4(config-router)#int loopback 1
- R4(config-if)#ip ospf network point-to-point
改cost值
- R2(config)#int f0/1
- R2(config-if)#ip ospf cost 64
//修改接口cost,通过修改接口cost值来影响ospf路由条目的度量值,决定路由条目加表,最终影响选路
明文认证:
- R1(config)#int f0/0
- R1(config-if)#ip ospf authentication
- R1(config-if)#ip ospf authentication-key 【密码】
MD5认证:
- R1(config)#int f0/0
- R1(config-if)#ip ospf authentication message-digest
- R1(config-if)#ip ospf message-digest-key 1 md5 【密码】