路由器的启动
与交换机启动时一样,在路由器启动之前,我们要检查路由器的各种连线是否连接正确。因为路由器上所连接的不可热插拔的线路比交换机更多,所以在路由器启动前检查要更加仔细。一旦连接错误,不能在路由器工作时插拔线路,一定要关闭路由器,再插拔不支持热插拔的线路。
show version命令
该命令可以看到路由器的型号、IOS的文件名、路由器的接口、内存,以及配置注册号等信息
show running-config命令
查看当前在内存中运行的配置命令。在我们排除故障或了解设备配置情况的时候,经常使用该命令。
show startup-config命令
查看保存在路由器NVRAM中的启动配置信息。
show interfaces命令
查看路由器各个接口的状态。在该命令后加上参数,可以单独查看某一个接口的状态。
需要启用某接口时,要人为将该接口的shutdown状态去除
#no shutdown
需要关闭某接口时,使用shutdown命令
#shutdown
show controllers命令
该命令可以查看接口控制器的信息,我们经常使用该命令查看接口上连接的串行线是DCE线还是DTE线
当我们配置完路由器之后,可以将所做的配置保存到路由器的NVRAM中,成为启动配置。以后路由器在重新启动时,就不用再进行配置了,路由器会自动把启动配置从NVRAM中调入内存运行。保存配置的命令如下:
Router#copy running-config startup-config
为路由器配置名字,使得设备之间可以方便地被区分,其命令如下:
Router(config)#hostname <hostname>
如果我们希望人们访问路由器时看到一条警告信息,我们可以使用如下命令:
Router(config)#banner motd # message #
(该命令中两个#之间的语句为警告信息。在配置了该语句之后,从路由器的任何接口登录上来都会看到这条信息。)
另外,我们也可以在一个接口中配置一个说明,以表明该接口的用途,命令格式如下:
Router(config-if)# description message
message是说明语句
可以在路由器上配置密码以保护路由器和我们的网络
路由器的密码有两种:一种是enable密码,它验证用户是否有配置路由器的权限;一种是配置在线路上的密码,它验证用户是否有通过该线路登录的权限。
enable密码有两种:明文的和加密的。
Router(config)#enable password <word>
Router(config)#enable secret <word>
明文的密码在我们使用show running-config命令时可以看到,加密的密码在我们使用showrunning-config命令时看到的是乱码。
当我们配置了明文的密码之后再配置加密的密码,明文的密码就失效了。另外,加密的密码不能和明文的密码一样。
在配置了enable密码之后,再从用户模式进入特权模式时,就会提示输入密码。
在console线上还可以配置下面两条命令。一条是:
Router(config-line)#exec-timeout 0 0
这条命令中前一个数字是分钟,后一个数字是秒,“00”表示没有设定空闲时间。在设定了空闲时间之后,一旦达到该空闲时间,IOS就会自动跳到刚刚启动路由器的界面,再想进入IOS进行配置,就要经过密码验证。这与Windows主机的屏幕保护加密码作用相同,用来防止在管理员不在时没有权限的人进入IOS进行配置。
另一条命令是:
Router(config-line)#logging synchronous
该命令是防止路由器输出到console的信息打断我们的命令。
路由器的基本配置
Router> Router> Router>en Router>enable Router#conf Router#configure t Enter configuration commands, one per line. End with CNTL/Z. Router(config)# Router(config)#hostname Rt99a Rt99a(config)#no ip Rt99a(config)#no ip do Rt99a(config)#no ip domain-lo Rt99a(config)#no ip domain-lookup 取消路由查找 Rt99a(config)#enable secret 99secret Rt99a(config)#line con 0 Rt99a(config-line)#password 99con Rt99a(config-line)#login Rt99a(config-line)#end Rt99a# %SYS-5-CONFIG_I: Configured from console by console Rt99a#copy running-config startup-config Destination filename [startup-config]? Building configuration... [OK] 保存配置 Rt99a#disable Rt99a>logout User Access Verification Password: 99con Password: Password: Rt99a> Rt99a> Rt99a> Rt99a>enable Password: Rt99a# 99secret Rt99a# Rt99a# --------------------------- Rt99a#conf t Enter configuration commands, one per line. End with CNTL/Z. Rt99a(config)#line vty 0 4 同时允许4个终端访问 Rt99a(config-line)#password 99vty04 Rt99a(config-line)#login Rt99a(config-line)#exit Rt99a(config)# -------------------------- Rt99a(config)#interface f Rt99a(config)#interface fastEthernet 0/0 Rt99a(config-if)#ip address 192.168.199.1 255.255.255.0 Rt99a(config-if)#no shutdown Rt99a(config-if)# %LINK-5-CHANGED: Interface FastEthernet0/0, changed state to up %LINEPROTO-5-UPDOWN: Line protocol on Interface FastEthernet0/0, changed state to up Rt99a(config-if)#end Rt99a# %SYS-5-CONFIG_I: Configured from console by console Rt99a#wri Rt99a#write 保存配置 Building configuration... [OK] Rt99a#
Router>en
Router>enable 进入特权模式
Router#
Router#
Router#confi
Router#configure t
Router#configure terminal 进入全局配置模式
Enter configuration commands, one per line. End with CNTL/Z.
Router(config)#hostname R1 修改路由器名为R1
R1(config)#no ip domain-lookup 防止DNS解析的命令
R1(config)#service password-encryption 把所有password用思科私有方式加密
R1(config)#enable secret class enable 配置执行模式口令(特权加密口令)
设置motd的提示信息 ,以#开头,以#结束,中间为显示内容
R1(config)#banner motd #Unauthorized access is strictly prohibited.#
R1(config)#line con 0 进入console线路口,因为console口在设备总是第一个线路,所以序号是0
R1(config-line)#password cisco 设置console密码
R1(config-line)#login 用户登录
R1(config-line)#logging synchronous 将日志消息输出和调试输出同步到路由器线路上:控制台、辅助和VTY线路
R1(config-line)#line vty 0 4 远程管理交换机
R1(config-line)#password cisco
R1(config-line)#login
R1(config-line)#
https://www.jb51.net/it/715207.html
https://www.cnblogs.com/evolve/p/9223751.html