此产品的文档集力求使用非歧视性语言。在本文档集中,非歧视性语言是指不隐含针对年龄、残障、性别、种族身份、族群身份、性取向、社会经济地位和交叉性的歧视的语言。由于产品软件的用户界面中使用的硬编码语言、基于 RFP 文档使用的语言或引用的第三方产品使用的语言,文档中可能无法确保完全使用非歧视性语言。 深入了解思科如何使用包容性语言。
思科采用人工翻译与机器翻译相结合的方式将此文档翻译成不同语言,希望全球的用户都能通过各自的语言得到支持性的内容。 请注意:即使是最好的机器翻译,其准确度也不及专业翻译人员的水平。 Cisco Systems, Inc. 对于翻译的准确性不承担任何责任,并建议您总是参考英文原始文档(已提供链接)。
本文档介绍一些可能增强NX-OS故障排除体验的快速提示和技巧。
十六进制表示十六进制十进制,十进制表示十进制
NX-OS# dec 0x89
137
NX-OS# hex 137
0x89
CLI代表命令行界面
N7k-LabSW# show clock ; show switchname ; show license host-id
19:10:59.016 UTC Mon Apr 04 2016
N7k-LabSW
License hostid: VDH=TBM14354170
#也适用于配置:
N7k-LabSW# conf t ; hostname N7k-LabSW-DEFAULT ; end
Enter configuration commands, one per line. End with CNTL/Z.
N7k-LabSW-DEFAULT#
# CLI完成所花的时间:
N7k-LabSW# show clock ; show run | ex .* ; show clock
07:56:08.709 UTC Tue Apr 05 2016
07:56:08.834 UTC Tue Apr 05 2016
N7k-LabSW# show cli variables
VSH Variable List (* = session vars)
-----------------
SWITCHNAME="N7k-LabSW"
TIMESTAMP="2016-04-05-08.34.18"
N7k-LabSW# tac-pac bootflash:$(SWITCHNAME)-$(TIMESTAMP)-show-tech-all.gz
N7k-LabSW# dir bootflash: | i show-tech-all
15091722 Apr 05 08:41:27 2016 N7k-LabSW-2016-04-05-08.35.57-show-tech-all.gz
还可以创建您自己的变量:
1)避免终端会话超时:
N7k-LabSW# show terminal | i Timeout
Session Timeout: 30 minutes
N7k-LabSW# terminal session-timeout ?
<0-525600> Enter timeout in minutes, 0 to disable
N7k-LabSW# terminal session-timeout 0
N7k-LabSW# show terminal | i Timeout
Session Timeout: 0 minutes
2)设置显示终端的宽度/长度:
当您不希望输出中断到长宽输出的新行时,该功能非常方便
N7k-LabSW# show terminal | i Width
Length: 25 lines, Width: 98 columns
N7k-LabSW# terminal width 300
N7k-LabSW# show terminal | i Width
Length: 25 lines, Width: 300 columns
N7k-LabSW# show clock ; sleep 10 ; show clock
19:27:07.435 UTC Mon Apr 04 2016
19:27:17.445 UTC Mon Apr 04 2016
VRF代表虚拟路由和转发
为特定VRF运行CLI,而不每次向命令添加VRF <>:
N7k-LabSW# routing-context vrf management
N7k-LabSW%management# sh ip route
IP Route Table for VRF "management"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
0.0.0.0/0, ubest/mbest: 1/0
*via 10.48.61.129, [1/0], 1w4d, static
10.48.61.128/26, ubest/mbest: 1/0, attached
*via 10.48.61.150, mgmt0, [0/0], 1w4d, direct
10.48.61.150/32, ubest/mbest: 1/0, attached
*via 10.48.61.150, mgmt0, [0/0], 1w4d, local
N7k-LabSW%management#
N7k-LabSW%management# routing-context vrf default
N7k-LabSW# sh ip route
IP Route Table for VRF "default"
'*' denotes best ucast next-hop
'**' denotes best mcast next-hop
'[x/y]' denotes [preference/metric]
'%<string>' in via output denotes VRF <string>
VDC代表虚拟设备环境
LC代表线路卡
N7K代表Nexus 7000
连接到LC后,CLI将针对默认VDC运行,或需要为相关命令指定VDC #。
您可以像路由情景一样在VDC #空间中运行CLI。
示例:
N7k-LabSW# attach module 4
Attaching to module 4 ...
To exit type 'exit', to abort type '$.'
module-4# show hardware mac address-table
FE | Valid| PI| BD | MAC | Index| Stat| SW | Modi| Age| Tmr| GM| Sec| TR| NT| RM| RMA| Cap| Fld|Always| PV | RD| NN| UC|PI_E8| VIF | SWID| SSWID| LID
| | | | | | ic | | fied|Byte| Sel| | ure| AP| FY| | |TURE| | Learn| | | | | | | | |
---+------+---+------+---------------+-------+-----+-----+-----+----+----+---+----+---+---+---+----+----+----+------|----|---|---|---|-----|-----|-----|------|-------
4 1 1 2 0023.ac66.1dc1 0x010c7 1 0x000 0 0 0 1 0 0 0 0 0 0 0 0 0x00 0 0 0 0 0x000 0x000 0x000 0x010c7
5 1 1 2 0023.ac66.1dc1 0x010c7 1 0x000 0 0 0 1 0 0 0 0 0 0 0 0 0x00 0 0 0 0 0x000 0x000 0x000 0x010c7
Command outputs from Default VDC are pulled here
module-4# vdc 6 >>>>>>> switches LC to pull this VDC specific outputs only
module-4# show hardware mac address-table
FE | Valid| PI| BD | MAC | Index| Stat| SW | Modi| Age| Tmr| GM| Sec| TR| NT| RM| RMA| Cap| Fld|Always| PV | RD| NN| UC|PI_E8| VIF | SWID| SSWID| LID
| | | | | | ic | | fied|Byte| Sel| | ure| AP| FY| | |TURE| | Learn| | | | | | | | |
---+------+---+------+---------------+-------+-----+-----+-----+----+----+---+----+---+---+---+----+----+----+------|----|---|---|---|-----|-----|-----|------|-------
0 1 1 92 0023.ac66.1dc6 0x010c7 1 0x000 0 0 0 1 0 0 0 0 0 0 0 0 0x00 0 0 0 0 0x000 0x000 0x000 0x010c7
0 1 0 91 0019.3074.9c02 0x00414 0 0x009 0 118 2 0 0 0 0 0 0 0 0 0 0x00 1 0 1 0 0x000 0x000 0x000 0x00414
N5600-Lab# load dplugg
Loading plugin version 7.1(1)N1(1)
###############################################################
Warning: debug-plugin is for engineering internal use only!
For security reason, plugin image has been deleted.
###############################################################
Successfully loaded debug-plugin!!!
Linux(debug)# vsh >>>>> Moves back to NX-OS prompt
Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (c) 2002-2015, Cisco Systems, Inc. All rights reserved.
The copyrights to certain works contained in this software are
owned by other third parties and used and distributed under
license. Certain components of this software are licensed under
the GNU General Public License (GPL) version 2.0 or the GNU
Lesser General Public License (LGPL) Version 2.1. A copy of each
such license is available at
http://www.opensource.org/licenses/gpl-2.0.php and
http://www.opensource.org/licenses/lgpl-2.1.php
N5600-Lab# show clock
20:20:07.468 UTC Mon Apr 04 2016
N5600-Lab# exit >>>>> Moves back to Linux prompt
Linux(debug)#
Linux(debug)# clock
Mon Apr 4 20:20:13 2016 -0.282195 seconds UTC
NOTE: "Debug Plugin" should only be used in presence of Cisco TAC and is not available for customer use.
Please do not modify any setting unless guided by Cisco TAC.
或者,NX-OS CLI可以直接从调试插件运行:
Linux(debug)# vsh -c "show switchname"
N5600-Lab
Linux(debug)# vsh -c "show module"
Mod Ports Module-Type Model Status
--- ----- ----------------------------------- ---------------------- -----------
1 52 Nexus 56128P Supervisor N5K-C56128P-SUP active *
Mod Sw Hw World-Wide-Name(s) (WWN)
--- -------------- ------ ---------------------------------------------------
1 7.1(1)N1(1) 1.1 --
<snipped>
VSH代表虚拟外壳
NEXUS-LABSWICTH# echo "hostname LAB" | vsh
LAB#
Mon Apr 4 20:51:14 2016:type=update:id=10.61.236.97@pts/1:user=admin:cmd=echo "hostname LAB" | vsh (SUCCESS)
Mon Apr 4 20:51:14 2016:type=start:id=vsh.9326:user=admin:cmd=
Mon Apr 4 20:51:14 2016:type=update:id=vsh.9326:user=admin:cmd=configure terminal ; hostname LAB (SUCCESS)
LAB# echo "hostname NEXUS-LABSWITCH" | vsh
NEXUS-LABSWITCH#
Mon Apr 4 20:51:23 2016:type=update:id=10.61.236.97@pts/1:user=admin:cmd=echo "hostname NEXUS-LABSWITCH" | vsh (SUCCESS)
Mon Apr 4 20:51:23 2016:type=start:id=vsh.9390:user=admin:cmd=
Mon Apr 4 20:51:23 2016:type=update:id=vsh.9390:user=admin:cmd=configure terminal ; hostname NEXUS-LABSWITCH (SUCCESS)
N5600-Lab# show run | i hostname | sed "s/N5600-Lab/N56128/" | vsh
N56128#
N56128# show accounting log | last 3
Mon Apr 4 21:23:23 2016:type=start:id=vsh.6762:user=admin:cmd=
Mon Apr 4 21:23:23 2016:type=update:id=vsh.6762:user=admin:cmd=configure terminal ; hostname N56128 (SUCCESS)
Mon Apr 4 21:23:23 2016:type=stop:id=vsh.6762:user=admin:cmd=
N5600-Lab# echo "hostname N56128" > bootflash:CLI
N5600-Lab#
N5600-Lab# show file CLI
hostname N56128
N5600-Lab# show file CLI | vsh
N56128#
差异代表差异
N5600-Lab# show int mgmt0 | diff
N5600-Lab# show int mgmt0 | diff
11,12c11,12
< 9393 input packets 829764 bytes
< 141 unicast packets 3715 multicast packets
---
> 9395 input packets 830217 bytes
> 142 unicast packets 3716 multicast packets
15,16c15,16
< 214 output packets 47396 bytes
< 27 unicast packets 181 multicast packets
---
> 215 output packets 47640 bytes
> 27 unicast packets 182 multicast packets
N9K代表Nexus 9000
BRU-N9K3-1# watch differences interval 1 show int mgmt0 counter
Every 1.0s: vsh -c "show int mgmt0 counter" Mon Apr 4 23:42:27 2016
CCO reference
CPU代表中央处理器
此命令每5秒(可以更改)提供一次输出,显示哪个进程消耗了CPU。它的输出与linux top命令相同:
NEXUS# show system internal processes cpu 5 | no-more
top - 12:41:55 up 117 days, 17:00, 5 users, load average: 0.44, 0.50, 0.55 Tasks: 2883 total, 2 running, 1022 sleeping, 0 stopped, 1859 zombie Cpu(s): 1.0%us, 0.9%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 32744992k total, 14563132k used, 18181860k free, 61308k buffers Swap: 0k total, 0k used, 0k free, 4091160k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 18465 admin 20 0 5200 3108 1148 R 16.6 0.0 0:00.17 top 6389 root 20 0 699m 53m 14m S 3.3 0.2 113:49.07 netstack 18473 root 20 0 97940 3804 2796 R 3.3 0.0 0:00.02 vsh 10 root 15 -5 0 0 0 S 1.7 0.0 9:10.85 ksoftirqd/2 4876 root 15 -5 369m 27m 6564 S 1.7 0.1 67:33.91 sysmgr 9581 svc-isan 20 0 446m 41m 11m S 1.7 0.1 21:16.15 isis_l2mp 1 root 20 0 1980 652 572 S 0.0 0.0 3:02.73 init 2 root 15 -5 0 0 0 S 0.0 0.0 0:00.03 kthreadd 3 root RT -5 0 0 0 S 0.0 0.0 0:00.49 migration/0 4 root 15 -5 0 0 0 S 0.0 0.0 22:48.66 ksoftirqd/0 5 root -2 -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 6 root RT -5 0 0 0 S 0.0 0.0 0:00.65 migration/1 7 root 15 -5 0 0 0 S 0.0 0.0 2:27.70 ksoftirqd/1 top - 12:42:01 up 117 days, 17:00, 5 users, load average: 0.37, 0.48, 0.54 Tasks: 2887 total, 1 running, 1027 sleeping, 0 stopped, 1859 zombie Cpu(s): 1.0%us, 0.9%sy, 0.0%ni, 98.0%id, 0.0%wa, 0.0%hi, 0.1%si, 0.0%st Mem: 32744992k total, 14562360k used, 18182632k free, 61308k buffers Swap: 0k total, 0k used, 0k free, 4091160k cached PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND 18502 admin 20 0 5200 3112 1148 R 18.5 0.0 0:00.17 top 6389 root 20 0 699m 53m 14m S 1.7 0.2 113:49.08 netstack 6402 root -2 0 366m 13m 8660 S 1.7 0.0 1032:41 clx 9015 root 20 0 482m 21m 11m S 1.7 0.1 225:45.72 pm 10066 svc-isan 20 0 403m 22m 9.9m S 1.7 0.1 268:31.28 ospf 10487 svc-isan 20 0 354m 9992 6596 S 1.7 0.0 194:52.11 ecp 1 root 20 0 1980 652 572 S 0.0 0.0 3:02.73 init 2 root 15 -5 0 0 0 S 0.0 0.0 0:00.03 kthreadd 3 root RT -5 0 0 0 S 0.0 0.0 0:00.49 migration/0 4 root 15 -5 0 0 0 S 0.0 0.0 22:48.66 ksoftirqd/0 5 root -2 -5 0 0 0 S 0.0 0.0 0:00.00 watchdog/0 6 root RT -5 0 0 0 S 0.0 0.0 0:00.65 migration/1 7 root 15 -5 0 0 0 S 0.0 0.0 2:27.70 ksoftirqd/1
N7k/N9k
N7k-LabSW# show version internal build-identifier
Kickstart image file: bootflash:///n7000-s2-kickstart.6.2.10.bin : S102
System image file: bootflash:///n7000-s2-dk9.6.2.10.bin : S102
BRU-N9K3-1# show version internal build-identifier
nxos image file: bootflash:///nxos.7.0.3.I2.2a.bin : S30
N5k/6k:
N5600-Lab# show platform fwm info global | i FwM
FwM build Details: Built at Sat Apr 18 11:11:18 PDT 2015 on nuo-sw-build40 in directory /auto/n5kiluka/daily_build/iplus/nexus/522/src/build by buildsa)