通过TFTP 服务器对路由器的维护

来源:互联网 发布:nginx alias 编辑:程序博客网 时间:2024/06/03 14:37
路由器提供的tftp 服务为tftp client,即路由器作为tftp client,文件服务器作为tftp server,用户通过在终端输入相应命令,可将本路由器的配置文件或应用程序上传到文件服务器上,或从文件服务器下载配置文件或应用程序到路由器中。

    1. 配置环境

    首先搭建硬件环境(详细步骤可参见4.5.2通过以太网口升级应用程序),把服务器的路径指向放置文件的文件夹。

   

    配置两边ip 地址为同一网络,本节在tftp 服务器端设置为192.168.0.1,与其相连的路由器以太网口(本例为ethernet 0/0,任何以太网口均可)设置为192.168.0.2。双方可以用ping 命令检验是否连接成功。

    2. 备份、恢复应用程序、配置文件

    在环境搭建好后,请在终端上做如下操作:

    通过dir 命令我们可以查看当前文件系统包含了哪些文件:

    [h3c]dir

    directory of cf:/

   

    63340 kb total (20928 kb free)

    file system type of cf: fat32

    [h3c]

    如果我们要把路由器上的config.cfg 文件备份到tftp 服务器上,并保存为config.bak 可以用如下命令:

    [h3c]tftp 192.168.0.1 put config.cfg config.bak

    file will be transferred in binary mode

    sending file to remote tftp server. please wait... tftp: 1045 bytes sent in 0 second(s).

    file uploaded successfully.

    从服务器上把服务器上的config.cfg 文件下载到路由器上的命令为:

    [h3c]tftp 192.168.0.1 get config.cfg config.cfg

    the file config.cfg exists. overwrite it?[y/n]:y

    verifying server file...

    deleting the old file, please wait...

    file will be transferred in binary mode

    downloading file from remote tftp server, please wait...tftp: 1045 bytes received in 0 second(s)

    file downloaded successfully.

    如果路由器上已经有一个同名文件系统会提示是否覆盖,选择[y/y]确认。

    1 备份的时候,有同名文件将会直接覆盖服务器上的文件。

    2 以上操作都是在用户视图下的操作

    3 备份的配置文件是可以由文本编辑器修改的,通过下载修改过的配置文件可以实现对配置的更改,所做更改会在下次启动后生效。同理,也可以把应用程序直接下载到路由器上,覆盖原有的主程序来实现应用程序的更新。
原创粉丝点击