본문 바로가기
네트워크/Cisco

[네트워크] Cisco Nexus(NX-OS) 팁 및 요령

by WYYOON 2023. 6. 30.
728x90
반응형
SMALL

빠른 16진수/12월 변환

16진수는 16진수를, 10진수는 12를 나타냅니다.

NX-OS# dec 0x89
137
NX-OS# hex 137
0x89

여러 CLI를 한꺼번에 실행

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

CLI 변수 사용

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

고유한 변수를 생성할 수도 있습니다.

CCO 참조

터미널 설정 사용자 지정

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는 가상 라우팅 및 포워딩을 의미합니다.

명령에 VRF <>를 추가하지 않고 특정 VRF에 대해 CLI를 실행합니다.

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>

LC에 연결할 때 각 VDC에 대해 CLI 실행:N7k별

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

디버그 플러그인을 종료하지 않고 Linux Kernel과 NX-OS 간 전환

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를 통해 직접 구성 로드

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#

Diffis 사용 - 카운터 간의 차이점을 나열합니다.

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

Watch CLI 사용 - 7.0(3)I2(x) 이후 N9k 전용

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 사용량 확인

CPU는 중앙 처리 장치를 의미합니다.

이 명령은 CPU를 사용하는 프로세스를 5초마다(변경할 수 있음) 출력을 제공합니다.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/dail

<참고자료>

https://www.cisco.com/c/ko_kr/support/docs/ios-nx-os-software/nx-os-software/200714-Nexus-NX-OS-tips-and-tricks.html

728x90
반응형
SMALL