基础命令练习

1.模式

Router> //用户模式

Router# //特权模式(也叫enable 模式)

Router(config-if)# //接口模式

Router(config-router)# //router 模式

Router(config-line)# //line 模式

Router(config-subif)# //子接口模式

 

2.模式切换

Router> //用户模式

Router>enable //在用户模式敲入enable 进入特权模式(也叫enable 模式)

Router#disable //在特权模式敲入disable 退出到用户模式

 

Router>enable //在用户模式敲入enable 进入特权模式

Router#configure terminal //在特权模式敲入configure terminal 进入到配置模式

Router(config)#interface ethernet 0/0 //在配置模式敲入interface+接口类型+接口编号进入接口模式

Router(config-if)#exit //敲入exit 退出接口模式

 

Router(config)#router rip //敲入“router + 路由协议进入router 模式

Router(config-router)#exit //退出router 模式

 

Router(config)#line console 0 //进入line 模式

Router(config-line)#end //line 模式退出(任何时候敲入end 会退出到特权模式)

 

Router#conf t

Router(config)#interface ethernet 0/0.1 //进入子接口模式

Router(config-subif)#end //任何时候敲入end 会退出到特权模式

Router#

 

2.为路由器定义名称

router(config)#hostname xxx(xxx 为我们定义的名称)

Router(config)#host fxh

fxh(config)#定义路由器的名称为FXH,那么对路由器定义名称,是为了区别我们所操作所有设备的不同.

 

3.为路由器添加特权密码

router(config)#enable password ssssss 为我们定义的明文密码)

router(config)#enable secret cisco (cisco 为我们定义的密文密码)

 

4.不执行 DNS 解析

router(config)#no ip domain-lookup (这条命令的作用是:当我们在执行命令错误的时候,路由器会认为这条命令没有错误,它只是一个域名的形式,那么他会给你解析,这样,很浪费我们宝贵的时间

5.配置路由器,使得控制台端口不会中止你的连接。

router(config-line)#exec-timeout 0

我们在长时间不去操作路由器的时候,我们的路由器会自动的终止与我们的对话连接,跳转到非连接状态,这时候,我们还需要输入enable 密码重新登陆,从某种意义上来讲是对安全性得到了保证,但是对我们的操作是十分的不方便的。

6.配置路由器,使得路由器发送的控制台屏幕的消息不会附加到命令行中

router(config)#line console 0

router(config-line)# logging synchronous

 

7.配置路由器,使得当登陆控制台端口的时候显示一个标题

router(config)#banner motd

Enter TEXT message. End with the character 'm'. 在这里M 是我们结束时候输入的结束控制字符,你最好找一个特殊的作为结束,例如~等等。Xxxxxxx(是我们定义的信息)

 

8..console 口的配置

Router(config)#line console 0

Router(config-line)#password [password] //设置con口登录密码

Router(config-line)#login

Router(config-line)#exit

9. VTY 口的配置

Router(config)#line vty 0 4 //不同设备或不同IOS可能数量不同

Router(config-line)#password [password]

Router(config-line)#login

Router(config-line)#exit

10. 配置以太网口

Router#conf t

Router(config)#int E0

Router(config-if)#ip address 192.168.1.1 255.255.255.0 //配置IP地址

Router(config-if)#no shutdown //激活该接口

11. 配置串行接口(需要配置时钟频率)

Router#conf t

Router(config)#int S0

Router(config-if)#clock rate 64000 // DCE设备配置时钟,DTE设备不用配置

Router(config-if)#ip address 192.168.1.1 255.255.255.0 //配置IP地址

Router(config-if)#no shutdown

12. 配置接口描述信息:

Router(config-if)#description link to stsd

13. 配置主机名与IP地址映射:

Router(config)#ip host stsd 192.168.113.1

Ping stsd = ping 192.168.113.1

14 清除路由器启动配置:

Rotuer#erase startup-config

15. 保存路由器当前配置:

Router#copy running-config startup-config 或者 Routerwrite

 

二:常用show命令

查看路由器版本

Router#show version

查看路由器flash

Router#show flash:

查看历史命令记录

Router#show history

查看接口物理相关信息

Router#show interfaces s0/0

查看接口协议相关信息

Router#show ip int s0/0

查看接口简要信息

Router#show ip int brief

查看路由器启动配置文件

Router#show running-config

查看路由器运行配置文件

Router#show running-config

查看当前登录的所有用户

Router#show users

查看路由器ARP

Router#show arp

三:路由器模式详解

用户模式

Router>

特权模式

Router#

全局配置模式

Router(config)#

接口模式

Router(config-if)#

子接口模式

Router(config-subif)#

线路配置模式

Router(config-line)#

路由配置模式

Router(config-router)#

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章