本產品的文件集力求使用無偏見用語。針對本文件集的目的,無偏見係定義為未根據年齡、身心障礙、性別、種族身分、民族身分、性別傾向、社會經濟地位及交織性表示歧視的用語。由於本產品軟體使用者介面中硬式編碼的語言、根據 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代表虛擬shell
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#
Diff代表差異
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)