您的位置:首页 > 其它

CCNA学习日记-05-设备启动配置与基础操作

2017-03-14 22:16 761 查看

简介

本文主要介绍PacketTracer中对设备进行如下操作:

1. 查看当前配置与启动配置文件

2. 修改设备配置(修改设备名称、设置设备密码等)

3. 保存当前配置到启动到启动配置文件

4. 重启设备

查看运行配置与启动配置文件

本文以 2950-24 交换机为例进行演示,使用 PacketTracer 7.0 模拟器。

设备有
startup-config
(启动配置文件)与
running-config
(运行配置文件)两个配置文件。

其中,
startup-config
是系统每次启动时加载的配置文件,
running-config
是设备目前运行在内存中正在使用的配置文件(断电丢失)。

当我们对设备配置进行修改后,悔立即反映在
running-config
中,但是,如果我们不将
running-config
保存到
startup-config
中,设备重启后,所有的修改都会丢失。

Switch>enable
Switch#show startup-config // 查看启动配置文件,但是由于尚未修改,所以为空
startup-config is not present
Switch#show running-config // 查看运行配置文件(未显示内容:Space 加载一页,Enter 加载一行)
Building configuration...

Current configuration : 979 bytes
!
version 12.1
no service timestamps log datetime msec
no service timestamps debug datetime msec
no service password-encryption
!
hostname Switch
!
!
!
spanning-tree mode pvst
!
interface FastEthernet0/1
!
interface FastEthernet0/2
!
interface FastEthernet0/3
!
interface FastEthernet0/4
--More--


修改设备配置

修改设备名称

为了方便区分不同的设备,通常需要对设备名称进行修改。

Switch#configure terminal
Enter configuration commands, one per line.  End with CNTL/Z.
Switch(config)#hostname sw1 //将设备名称由默认的 "Switch" 修改为 "sw1"
sw1(config)#


设置设备密码

为了防止未授权用户对设备配置进行修改,需要设置设备密码。

设备密码分 明文密码密文密码 两种,区别在于在配置文件中的显示方式,明文密码会以明文显示,密文密码一般会以其MD5值显示。

设置设备密码后,由 用户模式 进入 特权模式 时,会要求输入密码。如果两种密码都设置了,密文密码生效。

sw1(config)#enable password mypwd //设置明文密码为 mypwd
sw1(config)#exit
sw1#exit
%SYS-5-CONFIG_I: Configured from console by console
sw1 con0 is now available
Press RETURN to get started.
sw1>
sw1>enable  # 请求进入特权模式
Password:   # 在此处输入明文密码 mypwd
sw1#
...

sw1#configure terminal
sw1(config)#enable secret MY_SECRET //设置密文密码为 MY_SECRET
sw1(config)#exit
sw1#exit
%SYS-5-CONFIG_I: Configured from console by console
sw1 con0 is now available
Press RETURN to get started.
sw1>
sw1>enable  # 请求进入特权模式
Password:   # 在此处输入密文密码 MY_SECRET
sw1#

# 如有兴趣,可通过 show running-config 查看运行配置文件中 明文密码 和 密文密码 存储显示的不同




删除设备密码

sw1(config)#no enable secret
sw1(config)#no enable password


保存配置

在修改完设备的配置后,为了避免设备断电丢失配置,需要将配置保存到启动配置文件中。

# 方式一: 建议用词方式,方式二可能在部分情况下无效
sw1# copy running-config startup-config

# 方式二
sw1# write

# 保存之后,可以再次运行  show startup-config 查看启动配置文件


重启并验证

sw1# reload     // 重启设备
sw1>            # 可以看到,修改的设备名仍然有效
sw1>enable
sw1#show running-config //查看运行配置文件
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: