此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 RFP 文档使用的语言或引用的第三方产品使用的语言,文档中可能无法确保完全使用非歧视性语言。 深入了解思科如何使用包容性语言。
思科采用人工翻译与机器翻译相结合的方式将此文档翻译成不同语言,希望全球的用户都能通过各自的语言得到支持性的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 Cisco Systems, Inc. 对于翻译的准确性不承担任何责任,并建议您总是参考英文原始文档(已提供链接)。
本文档介绍如何安全地擦除使用标准Linux实用程序的Cisco Nexus交换机的磁盘。 对于某些军事和政府客户将设备从安全区域移动到非安全区域,或具有合规性要求的任何其他客户将设备移出其所在地来说,这是必要的。
有两种选项取决于交换机是SSD还是eUSB驱动器:
在已编档的过程中所使用的标准应用工具使用了一系列可安全地销毁存储磁盘上数据的命令,多数情况下使恢复数据变得困难或不可能。
本指南将带您了解Cisco Nexus 3000系列交换机、Cisco Nexus 5000系列交换机、Cisco Nexus 9000系列交换机、Cisco Nexus 7000系列交换机和Cisco MDS系列交换机的两个流程,但适用于大多数其他Cisco Nexus交换机,前提是您具有init-system或Bash访问权限。 如果您运行的交换机或软件版本不支持启用feature bash以访问Bash外壳,请通过Cisco TAC打开服务请求,以获取有关使用此过程的调试插件的帮助。
如果PID返回值0,则系统使用SSD,并且可以使用Init-System方法擦除驱动器。
如果PID返回值1,则系统使用eUSB驱动器,您需要使用零字节擦除方法。
F340.23.13-C3064PQ-1# config terminal Enter configuration commands, one per line. End with CNTL/Z.
F340.23.13-C3064PQ-1(config)# feature bash-shell
F340.23.13-C3064PQ-1(config)#
F340.23.13-C3064PQ-1(config)# exit
F340.23.13-C3064PQ-1# run bash bash-4.2$ cat /sys/block/sda/queue/rotational 1 bash-4.2$
执行上述步骤后,如果仍然不清楚您的系统中是哪种类型的驱动器,以及应该使用什么步骤安全擦除磁盘的内容,请向Cisco TAC提出服务请求。
在擦除驱动器之前,必须具备以下条件:
注意:强烈建议您对不再生产或安装在生产机箱中的部件执行此过程。在执行此步骤之前,应将这些设备或部件移到非生产环境中,以避免任何无意的网络中断。
注意:在基于模块化的交换机内部的Supervisor上执行此过程时,建议仅在系统中安装您计划执行此过程的Supervisor。
loader > cmdline recoverymode=1
loader > boot bootflash:nxos.7.0.3.I7.8.bin
注意:此测试在N9K-C9372TX-E上进行,该处理器配备英特尔酷睿i3- CPU(2.50GHz)和110G SSD。 初始化系统的总时间大约为8秒:
switch(boot)# clear nvram
switch(boot)# init system This command is going to erase your startup-config, licenses as well as the contents of your bootflash:. Do you want to continue? (y/n) [n] y
switch(boot)# reload This command will reboot this supervisor module. (y/n) ? y
注意:当您在基于模块化的交换机内部的Supervisor上执行此过程时,建议仅在系统中安装您计划执行此过程的Supervisor。
2.从配置模式启用feature bash-shell,然后使用run bash(仅N3K/9K)进入Bash-prompt。 其他Cisco Nexus交换机需要调试插件才能访问Bash)。
F340.23.13-C3064PQ-1# config terminal
F340.23.13-C3064PQ-1(config)# feature bash-shell F340.23.13-C3064PQ-1(config)# exit
F340.23.13-C3064PQ-1# run bash
bash-4.2$
N7K-1# load n7000-s2-debug-sh.7.2.1.D1.1.gbin
Loading plugin version 7.2(1)D1(1)
###############################################################
Warning: debug-plugin is for engineering internal use only!
For security reason, plugin image has been deleted.
###############################################################
Successfully loaded debug-plugin!!!
Linux(debug)#
3.通过sudo su获取root权限 —
注意:对于使用此过程的调试插件的Cisco Nexus 7000系列交换机,可跳过此步骤。
bash-4.2$ sudo su - root@F340#
4.如果是在Nexus 9000系列交换机中安装的系统控制器上执行此过程,则必须远程登录要执行此过程的插槽编号。 例如,此处对插槽29中的系统控制器执行:
N9K-EOR# run bash
bash-4.2$ sudo su -
root@N9K-EOR#rlogin lc29
root@sc29:~#
5.使用fdisk -l验证每个磁盘的块大小。 在N3K-C3064PQ-10X上,它只有/dev/sda @ 512字节块大小,请参阅此处:
注意:在一些Cisco Nexus交换机上,可能不止一个磁盘。执行dd操作时,必须将其考虑在内。例如,N7K-SUP2上有/dev/sda、/dev/sdb、/dev/sdc/、/dev/md2、/dev/md3、/dev/md4、/dev/md5和xun/dev/md6。您必须对其中每一项执行dd操作才能正确完成安全擦除过程。
注意:在Cisco Nexus 9000系列交换机上,系统控制器具有/dev/mtdblock0、/dev/mtdblock1、/dev/mtdbloc2、/dev/mtdblock3、/dev/mtdblock4、 /dev/mtdblock5和xdev/mtdblock6。 您必须对其中每一项执行dd操作才能正确完成安全擦除过程。
root@F340# fdisk -l Disk /dev/sda: 2055 MB, 2055208960 bytes 64 heads, 62 sectors/track, 1011 cylinders Units = cylinders of 3968 * 512 = 2031616 bytes Disk identifier: 0x8491e758 Device Boot Start End Blocks Id System /dev/sda1 1 5 9889 83 Linux /dev/sda2 6 45 79360 5 Extended /dev/sda3 67 1011 1874880 83 Linux /dev/sda4 46 66 41664 83 Linux /dev/sda5 6 26 41633 83 Linux /dev/sda6 27 45 37665 83 Linux
6.将零字节写入磁盘上的每个扇区。
注意:本测试是在采用英特尔赛扬CPU P4505 @1.87 GHz和13G eUSB的N3K-C3064PQ-10X上进行的,零字节过程耗时约501秒。
root@F340# dd if=/dev/zero of=/dev/sda bs=512
注意:在此步骤中,预期会在某些部分上看到生成的内核消息。
7.完成步骤5后,重新加载交换机、Supervisor或系统控制器:
注意:要在Cisco Nexus 9000系列模块化交换机中重新加载系统控制器,请输入reload module <slot_number> CLI。
bash-4.2$ exit F340.23.13-C3064PQ-1# exit F340.23.13-C3064PQ-1# reload WARNING: There is unsaved configuration!!! WARNING: This command will reboot the system Do you want to continue? (y/n) [n] y
1.通过控制台端口登录交换机的管理员帐户。
2.从配置模式启用feature bash-shell,然后使用run bash(仅限N3K/N9K)进入Bash-prompt。 其他Cisco Nexus交换机需要调试插件才能访问Bash)。 如果您需要调试插件,请与Cisco TAC联系,然后执行第3步而不是第2步。
注意:要从Bash-prompt访问LC/FM,请在获得根访问权限后输入rlogin lc# CLI。现在用要对其执行操作的插槽编号替换CLI中的#。
N7K-1# config terminal
Enter configuration commands, one per line. End with CNTL/Z.
N7K-1(config)# feature bash-shell
N7K-1(config)# exit
N7K-1# run bash
bash-4.3$
N9K-EOR# run bash
bash-4.2$ sudo su -
root@N9K-EOR#rlogin lc22
root@fm22:~#
3.对于使用debug插件的Cisco Nexus交换机,请确保将正在运行的软件版本的调试插件复制到bootflash,并在要为其运行安全擦除过程的模块上加载调试插件:
注意:与Supervisor模块可用的调试插件映像不同,Nexus 7000系列交换机I/O模块使用单独的调试插件映像。将LC映像用于交换机上运行的软件版本。
switch# attach module 3
Attaching to module 3 ...
To exit type 'exit', to abort type '$.'
module-3# load bootflash:dplug-lc_p476-bin.7.2.1.D1.1.bin
Name of debug-plugin from SUP: '/bootflash/dplug-lc_p476-bin.7.2.1.D1.1.bin'
Downloaded debug-plugin to LC: '/tmp/dplug-lc_p476-bin.7.2.1.D1.1.bin'
Loading plugin version 7.2(1)D1(1)
###############################################################
Warning: debug-plugin is for engineering internal use only!
###############################################################
Warning: /debug-plugin/.autorun is using deprecated /bin/bash. Please change to /bin/sh
Successfully loaded debug-plugin!!!
Linux(debug)#
4.接下来,对于Cisco Nexus 7000系列线卡,确定/logflash/和/mnt/pss在文件系统中的安装位置。 为此,请使用mount命令查找/mnt/plog(logflash)和/mnt/pss的位置。
注意:对于Cisco Nexus 9000系列线卡,对/dev/mmcblk0执行dd操作。
注意:对于Cisco Nexus 9000系列交换矩阵模块,请对/tmpfs、/dev/root、/dev/zram0、/dev/loop0、/dev/loop1和/unionfs执行dd操作。
Linux(debug)# mount | grep plog
/dev/mtdblock2 on /mnt/plog type jffs2 (rw,noatime)
Linux(debug)#
Linux(debug)# mount | grep pss
tmpfs on /mnt/pss type tmpfs (rw,size=409600k,mode=777)
Linux(debug)#
5.现在已知/mnt/plog驻留在/dev/mtdblock2上,而/mnt/pss驻留在/tmpfs上,您可以使用dd命令将零字节写入到两者,从debug插件中退出,然后重新加载模块:
Linux(debug)# dd if=/dev/zero of=/dev/mtdblock2 bs=1024
dd: writing '/dev/mtdblock2': No space left on device
15361+0 records in
15360+0 records out
Linux(debug)#
Linux(debug)# dd if=dev/zero of=/tmpfs bs=1024
dd: writing '/tmpfs': No space left on device
23781+0 records in
23780+0 records out
Linux(debug)#
Linux(debug)# exit
####################################################################
Warning: for security reason, please delete plugin image on sup.
####################################################################
module-3# exit
rlogin: connection closed.
switch#
switch# reload module 3
This command will reload module 3. Proceed[y/n]? [n] y
reloading module 3 ...
switch#
重新通电交换机后,它将在加载程序提示符下启动。
要从loader>提示符中恢复,交换机必须按照以下步骤进行TFTP启动:
loader > set ip <IP_address> <Subnet_Mask>
2.如果引导所来自的TFTP服务器位于不同的子网中,请为交换机分配默认网关:
loader > set gw <GW_IP_Address>
3.执行启动过程。 交换机启动到交换机(启动)提示符。
注意:对于使用单独系统/启动映像的交换机(如Cisco Nexus 5000系列交换机、Cisco Nexus 6000系列交换机和Cisco Nexus 7000系列交换机),在此步骤中您需要启动启动映像。 对于使用单个NXOS映像的交换机(如Cisco Nexus 9000系列交换机和Cisco Nexus 3000系列交换机),在此步骤您需要启动单个映像:
loader > boot tftp:///
4.执行clear nvram、Init system和format bootflash:
注意:对于Cisco Nexus 5000系列交换机和Cisco Nexus 6000系列交换机,clear nvram在switch(boot)#提示符下不可用。
switch(boot)# clear nvram
switch(boot)# init system
This command is going to erase your startup-config, licenses as well as the contents of your bootflash:.
Do you want to continue? (y/n) [n] y
Initializing the system ...
<snip>
switch(boot)# format bootflash:
This command is going to erase the contents of your bootflash:.
Do you want to continue? (y/n) [n] y
get_sup_active_slot failed with -1
Unknown card
Formatting bootflash:
<snip>
5.重新加载交换机:
switch(boot)# reload
This command will reboot this supervisor module. (y/n) ? y
ˇ
(c) Copyright 2011, Cisco Systems.
N3000 BIOS v.5.0.0, Tue 06/05/2018, 05:24 PM
6.为交换机上的mgmt0接口设置(或分配)IP地址:
loader > set ip <IP_address> <Subnet_Mask>
7.如果引导所使用的TFTP服务器位于不同的子网中,请为交换机分配默认网关:
loader > set gw <GW_IP_Address>
8.重新加载交换机:
注意:在Cisco Nexus 5000系列交换机、Cisco Nexus 6000系列交换机、Cisco Nexus 7000系列交换机Supervisor模块或Cisco Nexus 9000系列交换机Supervisor模块上执行此过程时,不需要执行此步骤(8)。 如果您在Cisco Nexus 5000系列交换机、Cisco Nexus 6000系列交换机、Cisco Nexus 7000系列交换机Supervisor模块或Cisco Nexus 9000系列交换机Supervisor模块上执行此程序,请跳至步骤9。
loader> reboot
9.执行启动过程。 交换机启动到switch(boot)提示符。
注意:对于使用单独系统/启动映像的交换机(如Cisco Nexus 7000系列交换机),在此步骤需要启动启动映像。 对于使用单个NXOS映像的交换机(如Cisco Nexus 9000系列交换机和Cisco Nexus 3000系列交换机),在此步骤您需要启动单个映像:
loader > boot tftp://<server_IP>/<nxos_image_name>
10.对于使用单独系统/启动映像的交换机(如Cisco Nexus 5000系列交换机、Cisco Nexus 6000系列交换机和Cisco Nexus 7000系列交换机),在此步骤中,您需要执行一些额外的步骤来启动交换机。 您需要配置管理0 IP地址和子网掩码以及定义默认网关。 完成此操作后,您可以将启动映像和系统映像复制到switch并加载该映像:
switch(boot)# config terminal
Enter configuration commands, one per line. End with CNTL/Z.
switch(boot)(config)# interface mgmt 0
switch(boot)(config-if)# ip address 10.122.160.55 255.255.255.128
switch(boot)(config-if)# no shutdown
switch(boot)(config-if)# exit
switch(boot)(config)#
switch(boot)(config)# ip default-gateway 10.122.160.1
switch(boot)(config)#
switch(boot)(config)# exit
switch(boot)#
switch(boot)#
switch(boot)# copy ftp: bootflash:
Enter source filename:
Enter hostname for the ftp server:
Enter username:
Connected to x.x.x.x.
220 CALO Fileserver
331 Please specify the password.
Password:
230 Login successful.
221 Goodbye.
Copy complete, now saving to disk (please wait)...
switch(boot)#
switch(boot)# copy ftp: bootflash:
Enter source filename:
Enter hostname for the ftp server:
Enter username:
Connected to x.x.x.x.
220 CALO Fileserver
331 Please specify the password.
Password:
230 Login successful.
221 Goodbye.
switch(boot)#
11.对于Cisco Nexus 5000系列交换机、Cisco Nexus 6000系列交换机和Cisco Nexus 7000系列交换机Supervisor模块,在switch(boot)#提示符下,输入load bootflash:<system_image>。 这将完成交换机的启动过程。
switch(boot)# load bootflash:<system_image>
12.成功加载系统映像后,您需要通过设置提示开始按照所需的规格配置设备。