使用TFTP服务器和Packet Tracer备份和还原思科路由器配置文件

时间:2020-03-21 11:42:43  来源:igfitidea点击:

将介绍如何使用IP地址为1.0.0.2的TFTP服务器对IP地址为1.0.0.1的以下路由器配置文件进行备份。

在本教程的此处,我们将讨论如何从tftp服务器恢复路由器配置。
首先要测试路由器的还原配置,我们需要首先擦除路由器上的配置。

R1#erase startup-config

Erasing the nvram filesystem will remove all configuration files! Continue? [confirm]

[OK]

Erase of nvram: complete

%SYS-7-NV_BLOCK_INIT: Initialized the geometry of nvram

擦除后,检查是否已成功擦除。

R1#show startup-config

startup-config is not present

R1#


现在您可以清楚地看到没有输出,意味着现在没有配置。这意味着所有内容都已删除。

注意:重新加载后,我有一个全新的路由器。意味着所有以前的配置都丢失了。

R1#reload

Proceed with reload? [confirm]

System Bootstrap, Version 12.3(8r)T8, RELEASE SOFTWARE (fc1)

Cisco 1841 (revision 5.0) with 114688K/16384K bytes of memory.

Self decompressing the image :

########################################################################## [OK]

Restricted Rights Legend

--- System Configuration Dialog --

Continue with configuration dialog? [yes/no]: no

Press RETURN to get started!

Router>

现在,重新加载后检查配置。

Router>enable

Router#show run

Building configuration...

Current configuration : 489 bytes

!

version 12.4

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname Router

!

!

!

spanning-tree mode pvst

!

interface FastEthernet0/0

no ip address

duplex auto

speed auto

shutdown

!

interface FastEthernet0/1

no ip address

duplex auto

speed auto

shutdown

!

interface Vlan1

no ip address

shutdown

!

ip classless


现在,您可以清楚地看到没有ip,没有主机名,所有内容都已从路由器以前的配置中删除。 因此,现在我们必须再次分配ip地址,以重新启动与tftp的连接,以便我们将配置文件恢复到以前的状态。

因此,我们将使用以下命令将我们的IOS配置文件从tftp服务器恢复到路由器。

Router#copy tftp running-config

Address or name of remote host []? 1.0.0.2

Source filename []? R1-config

Destination filename [running-config]?

Accessing tftp://1.0.0.2/R1-config........

%Error opening tftp://1.0.0.2/R1-config (Timed out)

Router#

我们可以清楚地看到从tftp服务器复制失败,因为路由器接口已关闭,我们必须手动设置路由器接口

Router#config t

Enter configuration commands, one per line. End with CNTL/Z.

Router(config)#int fa0/0

Router(config-if)#ip address 1.0.0.1 255.0.0.0

Router(config-if)#no shut

现在我们的路由器接口又有一个IP地址,端口也已启动,现在我们可以开始还原过程了。

Router#copy tftp running-config

Address or name of remote host []? 1.0.0.2

Source filename []? R1-config

Destination filename [running-config]?

Accessing tftp://1.0.0.2/R1-config....

Loading R1-config from 1.0.0.2: !

[OK - 552 bytes]

552 bytes copied in 3.003 secs (183 bytes/sec)

R1#

%SYS-5-CONFIG_I: Configured from console by console

现在检查我们是否能够成功还原IOS配置文件。

R1#show run

Building configuration...

Current configuration : 552 bytes

!

version 12.4

no service timestamps log datetime msec

no service timestamps debug datetime msec

no service password-encryption

!

hostname R1

!

!

spanning-tree mode pvst

!

interface FastEthernet0/0

ip address 1.0.0.1 255.0.0.0

duplex auto

speed auto

!

interface FastEthernet0/1

no ip address

duplex auto

speed auto

shutdown

!

interface Vlan1

no ip address

shutdown

!

ip classless

!

!

line con 0

password redhat123

login

!

line aux 0

!

line vty 0

password redhat

login

line vty 1 4

login

!

end

--More-

我们可以清楚地看到,现在我们的路由器已启动。一切恢复原样。控制台端口的密码相同,因为它是telnet的配置。一切都是如此。