如果需要将博科交换机的配置保存到本地电脑,可以通过configupload命令将博科交换机的配置以文本格式存到本地。如果交换机出了问题可以通过这个配置文件用configdownload命令进行恢复。
注意:
比较新博科交换机目前只支持scp和sftp两种方式保存及恢复配置,一般情况下还是使用ftp的方式比较多,注意这里是ftp而不是tftp,这时候就需要开启ftp的支持,开启方法看这里:华为SNS交换机(OEM博科FC交换机)configupload无法使用ftp协议处理方法
需要在本地计算机上开启ftp服务,或者交换机可达的某个ftp服务器上,保存博科交换机配置时需要可写权限,本人用的是Linux笔记本办公,所以我使用ssh自带的scp和sftp即可。
1、开启ssh server服务,同时开启防火墙22端口或关闭防火墙, 其中我笔记本的IP地址为10.77.77.100, 用户为:pipci, 用户密码为:root。如果是windows系统推荐用FileZilla Server软件搭建ftp服务器进行相应的配置。
2、交换机上执行configupload命令,备份配置文件
switch:admin> configupload
Protocol (scp, ftp, sftp, local) [ftp]: scp ##括号里显示了支持的协议,这里我选择使用的是csp
Do you want to continue with CRA (Y/N) [N]: ##这里一定要选择N不使用CRA,否则后面的备份会失败,[]里面的内容为默认选择,如果是相同选择,直接回车即可
Server Name or IP Address [host]: 10.77.77.100 ##备份笔记本的IP地址
User Name [user]: pipci ##备份笔记本系统的用户名
Path/Filename [<home dir>/config.txt]: ##备份文件存放的目录及备份的文件名,默认备份到用户的主目录同时文件名为config.txt
Section (all|chassis|switch [all]): ##备份的类型,这里备份所有
pipci@10.77.77.100's password: ##输入备份笔记本系统用户名对应的密码
configUpload complete: All selected config parameters are uploaded ##显示这个说明保存成功,在我笔记本的/home/pipci/目录下会生成一个文件名为config.txt的文件
SNS2624_D12:admin>
------------------------------------------------------
3、交换机上执行configdownload命令,恢复备份的配置文件
------------------------------------------------------
switch:admin> switchdisable ##恢复前一定要先停用交换机
switch:admin> configdownload
Protocol (scp, ftp, sftp, local) [ftp]: scp
Do you want to continue with CRA (Y/N) [N]: n ##这里一定要选择N不使用CRA,否则后面的恢复会失败
Server Name or IP Address [host]: 10.77.77.100
User Name [user]: pipci
Path/Filename [<home dir>/config.txt]: ##这里的文件名一定要和你备份的一样,我备份的文件名就是config.txt所以用默认选项直接回车就可以,同时这个文件应该在你的用户主目录下
Section (all|chassis|switch [all]): ##你备份的是什么类型这里就要选择什么类型,不要选错
*** CAUTION ***
This command is used to download a backed-up configuration
for a specific switch. If using a file from a different
switch, this file's configuration settings will override
any current switch settings. Downloading a configuration
file, which was uploaded from a different type of switch,
may cause this switch to fail.
A switch reboot is required for the changes to take effect.
Please reboot the system for the configuration to be effective
configDownload operation may take several minutes
to complete for large files.
Do you want to continue [y/n]: y ##输入y继续
pipci@10.77.77.100's password:
Doing configDownload on switch ...
Activating configDownload: Switch is disabled
configDownload complete: All selected config parameters are downloaded ##恢复成功
switch:admin> cfgshow ##查看恢复的配置信息
Defined configuration:
cfg: cfg1 zone1_hw2288Hv5_2_H1_P0_to_hw5300v5_1_Ca_All;
zone2_hw2288Hv5_3_H1_P0_to_hw5300v5_1_Ca_All;
zone3_hw2288Hv5_4_H1_P0_to_hw5300v5_1_Ca_All;
zone4_hw2288Hv5_5_H1_P0_to_hw5300v5_1_Ca_All;
zone5_hw2288Hv5_6_H1_P0_to_hw5300v5_1_Ca_All
cfg: cfg2 zone1_hw2288Hv5_2_H1_P0_to_hw5300v5_1_Ca_All;
zone2_hw2288Hv5_3_H1_P0_to_hw5300v5_1_Ca_All
zone: zone1_hw2288Hv5_2_H1_P0_to_hw5300v5_1_Ca_All
hw2288Hv5_2_H1_P0; hw5300v5_1_Ca_All
zone: zone2_hw2288Hv5_3_H1_P0_to_hw5300v5_1_Ca_All
hw2288Hv5_3_H1_P0; hw5300v5_1_Ca_All
zone: zone3_hw2288Hv5_4_H1_P0_to_hw5300v5_1_Ca_All
hw2288Hv5_4_H1_P0; hw5300v5_1_Ca_All
zone: zone4_hw2288Hv5_5_H1_P0_to_hw5300v5_1_Ca_All
hw2288Hv5_5_H1_P0; hw5300v5_1_Ca_All
zone: zone5_hw2288Hv5_6_H1_P0_to_hw5300v5_1_Ca_All
hw2288Hv5_6_H1_P0; hw5300v5_1_Ca_All
alias: hw2288Hv5_2_H1_P0
88:99:44:67:dd:ad:ba:18
alias: hw2288Hv5_3_H1_P0
88:99:44:67:dd:ad:ba:08
alias: hw2288Hv5_4_H1_P0
88:99:44:67:dd:ad:ba:0a
alias: hw2288Hv5_5_H1_P0
88:99:44:67:dd:ad:ba:00
alias: hw2288Hv5_6_H1_P0
88:99:44:67:dd:ad:ba:06
alias: hw5300v5_1_Ca_All
99:88:c8:a7:76:b2:48:73; 77:88:c8:a7:76:b2:48:73
alias: hw5300v5_1_Ca_all
12,0; 12,1
Effective configuration:
cfg: cfg1
zone: zone1_hw2288Hv5_2_H1_P0_to_hw5300v5_1_Ca_All
88:99:44:67:dd:ad:ba:18
99:88:c8:a7:76:b2:48:73
77:88:c8:a7:76:b2:48:73
zone: zone2_hw2288Hv5_3_H1_P0_to_hw5300v5_1_Ca_All
88:99:44:67:dd:ad:ba:08
99:88:c8:a7:76:b2:48:73
77:88:c8:a7:76:b2:48:73
zone: zone3_hw2288Hv5_4_H1_P0_to_hw5300v5_1_Ca_All
88:99:44:67:dd:ad:ba:0a
99:88:c8:a7:76:b2:48:73
77:88:c8:a7:76:b2:48:73
zone: zone4_hw2288Hv5_5_H1_P0_to_hw5300v5_1_Ca_All
88:99:44:67:dd:ad:ba:00
99:88:c8:a7:76:b2:48:73
77:88:c8:a7:76:b2:48:73
zone: zone5_hw2288Hv5_6_H1_P0_to_hw5300v5_1_Ca_All
88:99:44:67:dd:ad:ba:06
99:88:c8:a7:76:b2:48:73
77:88:c8:a7:76:b2:48:73
switch:admin> switchenable ##如果恢复正常,启动交换机
switch:admin>cfgsave ##在进行一次配置的保持,其实上面的恢复已经将配置保持的交换机的非易失性存储介质
来源:oschina
链接:https://my.oschina.net/u/4396695/blog/3235737