路由交换技术与实践
上QQ阅读APP看书,第一时间看更新

1.2.5 配置命令

1. 命名路由器

Router(config)#hostname name

name:设备的名称。设备名称要以字母开头,以字母或数字结尾,仅可使用字母、数字和破折号,不可包含空格,长度须小于64个字符。

2. 路由器的Console口加密

Router(config)#line console 0
Router(config-line)#password password
Router(config-line)#login

password:路由器的Console口登录密码。

login:对命令启用密码检查。

3. 使能密码的配置

Router(config)#enable password password

4. 使能加密密码的配置

Router(config)#enable secret password

5. VTY密码的配置

Router(config)#line vty 0 4
Router(config-line)#password password
Router(config-line)#login

6. 加密密码显示

Router(config)#service password-encryption

7. 配置接口

(1)指定接口的类型和编号以进入接口配置模式

Router(config)#interface type number

type number:接口的类型和编号。

(2)配置IP地址和子网掩码

Router(config-if)#ip address ip-address mask

ip-address:接口的IP地址。

mask:接口IP地址对应的子网掩码。

(3)接口描述

Router(config-if)#description description

description:为每个接口配置的说明文字。说明文字的长度不能超过240个字符,可以说明接口所连接的网络信息以及该网络中是否还有其他路由器等信息。

(4)激活接口

Router(config-if)#no shutdown

8. 保存配置

Router#copy running-config startup-config
Router#write memory
注意

以上两条保存配置命令,只要在设备的特权执行模式下配置其中的任意一条,就可以实现对设备配置更改的保存。

9. 删除启动配置

Router#erase startup-config

10. 重启设备

Router#reload

11. 查看运行配置和启动配置

Router#show running-config
Router#show startup-config

12. 显示与当前加载的IOS版本以及硬件和设备相关的信息

Router#show version

13. 查看接口信息

Router#show interfaces
Router#show ip interface brief