H3C的Comware软件平台是H3C公司的核心软件平台。作为一个成熟的、特性丰富的软件平台,Comware软件平台构筑了H3C公司全系列IP网络产品的基础。对于这些网络设备,不仅需要软件平台,还有配置文件(配置文件用来保存用户对以太网交换机进行的配置,记录用户的整个配置过程。通过配置文件,用户可以非常方便地查阅这些配置信息。),掌握几个常用的命令可以方便我们的日常管理和维护工作。

 ⑴pwd命令,显示当前目录

<H3C-e126a>pwd
unit1>flash:


⑵dir命令,显示当前目录下的文件

<H3C-e126a>dir
Directory of unit1>flash:/

1 (*)   -rw-   3721478  Mar 17 2008 11:53:14   s31ei_e-cmw310-r2107p01.bin
2 (*)   -rw-    854899  Jan 01 2004 00:00:00   h3c-http3.1.8-0036.web
3 (*)   -rw-      2457  Apr 02 2000 00:00:18   main.cfg
4       -rw-      2457  Apr 02 2000 00:21:21   config.cfg

7239 KB total (2757 KB free)

(*) -with main attribute   (b) -with backup attribute
(*b) -with both main and backup attribute


上面的显示结果中,s31ei_e-cmw310-r2107p01.bin是Comware软件平台的系统软件,h3c-http3.1.8-0036.web是客户端以web方式访问设备的配置文件;main.cfg及config.cfg是设备配置文件,其中main.cfg是“main属性”。dir/all可以当前目录下所有的文件,包括隐藏文件等。
<H3C-e126a>dir /all
Directory of unit1>flash:/

1 (*)   -rw-   3721478  Mar 17 2008 11:53:14   s31ei_e-cmw310-r2107p01.bin
2 (*)   -rw-    854899  Jan 01 2004 00:00:00   h3c-http3.1.8-0036.web
3 (*)   -rw-      2457  Apr 02 2000 00:00:18   main.cfg
4       -rw-      2457  Apr 02 2000 00:21:21   config.cfg
5       -rwh       151  Apr 02 2000 00:31:02   private-data.txt
6       -rw-      1716  Apr 02 2000 00:23:32   [config.def]

7239 KB total (2757 KB free)

(*) -with main attribute   (b) -with backup attribute
(*b) -with both main and backup attribute

H3C设备的配置文件按其作用的时间域分为两种:起始配置:当交换机启动时,根据读取的配置文件,进行初始化工作,该配置称为起始配置(saved-configuration)。如果交换机中没有配置文件,则在启动过程中使用空配置进行初始化。当前配置:与起始配置相对应,当交换机运行时,用户对交换机进行的配置称为当前配置(current-configuration)。当前配置保存在交换机的临时存储器中,交换机重启之后会失效。

当我们对一台设备(交换机、路由器等)进行配置操作时,它会默认地保存在当前配置(current-configuration)文件中,如果想在下次启动时使用,必需保存到起始配置(saved-configuration)文件中。

H3C配置文件的main/backup属性。main表示配置文件的主用属性,backup表示配置文件的备用属性。交换机上可以同时存在主用、备用两种属性的配置文件。当主用配置文件损坏或者丢失的时候,可以使用备用配置文件来启动或配置交换机。相对于只支持单种配置文件的系统,这种双重保护的方式增强了文件系统的安全性和可靠性。用户可以通过命令设置配置文
件的main/backup属性。同一配置文件可以同时具有主备用属性,但在同一时刻,同一属性的文件,交换机上只能有一个。

 ⑶startup命令。

<H3C-e126a>startup saved-configuration config.cfg backup
Please wait......Done!
<H3C-e126a>
%Apr  2 01:00:32:834 2000 xixian-pengdianxx-zx-e126a CFM/3/CFM_LOG:- 1 -Unit1 se
t the configuration successfully.

上面“startup saved-configuration config.cfg backup”命令表示把已经保存的config.cfg配置文件设置为backup
属性。我们用“dir”命令查看文件时,发现config.cfg前面多了"<b>",这就表示config.cfg的属性是"backup"
<H3C-e126a>dir
Directory of unit1>flash:/

1 (*)   -rw-   3721478  Mar 17 2008 11:53:14   s31ei_e-cmw310-r2107p01.bin
2 (*)   -rw-    854899  Jan 01 2004 00:00:00   h3c-http3.1.8-0036.web
3 (*)   -rw-      2457  Apr 02 2000 00:00:18   main.cfg
4 (b)   -rw-      2457  Apr 02 2000 00:21:21   config.cfg

7239 KB total (2757 KB free)

(*) -with main attribute   (b) -with backup attribute
(*b) -with both main and backup attribute


<H3C-e126a>display startup
UNIT1:
Current Startup saved-configuration file:          flash:/main.cfg
Next main startup saved-configuration file:        flash:/main.cfg
Next backup startup saved-configuration file:      flash:/config.cfg
Bootrom-access enable state:                       enabled

 ⑷tftp命令的备份与恢复

tftp命令需要与tftp服务器相配合使用,使用tftp命令把H3C设备的系统文件(Comware软件)及配置文件备份到tftp服务
器上,也可以把备份的文件恢复到H3C设备上。

<S5600>tftp 10.63.254.198 put config.cfg //把当前的配置文件config.cfg备份到tftp服务器10.63.254.198上
File will be transferred in binary mode.
Sending file to remote tftp server. Please wait... /
TFTP:     3100 bytes sent in 0 second(s).
File uploaded successfully.

<S5600>tftp 10.63.254.198 put config.cfg S5600xd.cfg  //备份重命名为:S5600xd.cfg
File will be transferred in binary mode.
Sending file to remote tftp server. Please wait... |
TFTP:     3100 bytes sent in 0 second(s).
File uploaded successfully.

<S5600>tftp 10.63.254.198 put  s5600-cmw310-r1602p01.bin //把H3C的Comware系统软件备份到tftp服务器上
File will be transferred in binary mode.
Sending file to remote tftp server. Please wait... \
TFTP:  5366541 bytes sent in 118 second(s).
File uploaded successfully.

<e126a>tftp 10.63.83.110 get e126apd.cfg config.cfg //把配置文件e126apd.cfg恢复到H3C的交换机上
File will be transferred in binary mode.
Downloading file from remote tftp server, please wait.......
TFTP:     2457 bytes received in 0 second(s).
File downloaded successfully.

在本例中使用的tftp server是Cisco TFTP Server,有关H3C的配置文件管理命令还很多,如mkdir、cd 、move等,有兴趣的朋友可以尝试练习。