Bits&Bricks
$ show search

Searches the blog, kb and courses. Press / to open it from anywhere, ↓ ↑ to move through the results and Enter to open one. On notes and lessons, [ and ] go to the previous and next page.

$ show running-config | section cisco

Commands in cisco/

82 snippets from 33 notes, in tree order. Each heading links to its note. for a cheat sheet.

C9K Control Plane Policy campus/catalyst/c9k

show platform software fed switch active punt cause summary
show platform software fed switch active cpu-interface
show platform software fed switch active punt cpuq all
sh platform software fed switch active punt cpuq br
show platform hardware fed switch 1 qos queue stats internal cpu policer
show platform software qos copp policy-info
show platform software qos copp class-info

C9K Interfaces & transceivers campus/catalyst/c9k

show interface <interface>  
show platform pm port-data <interaface>  
show inventory  
show idprom interface <interface> detail  
diagnostic start switch <switch number> test DiagPhyLoopbackTest port <port numbers>  
show diagnostic result switch <switch number> test DiagPhyLoopbackTest detail  
request platform software trace archive <last x days>

C9K Line cards campus/catalyst/c9k

show inventory  
show module  
show power detail  
show post

C9K MAC flaps campus/catalyst/c9k

show logging  
show interface status  
show spanning-tree detail  
show spanning-tree detail | inc rstp|occurr|from|is exec

C9K Performance campus/catalyst/c9k

show interface <interface>  
show controller ethernet-controller <interface>  
show platform hardware fed switch <number of switch> qos queue stats interface <interface>  
clear platform hardware fed switch <number of switch> qos statistics interface <interface>  
Switch(config)#qos queue softmax multiplier <percentage 100-1200>  
show platform hardware fed switch <number of switch> qos dcsp-cos counters interface <interface>

C9K Power over Ethernet campus/catalyst/c9k

show power inline  
diagnostic start switch <switch number> test DiagPoETest  
show diagnostic result switch <switch number> test DiagPoETest detail  
show post  
show tech-support poe

C9K StackWise campus/catalyst/c9k

show switch detail  
show platform software stack-mgr switch <switch number> r0 sdp-counters  
show switch stack-ports detail  
show platform hardware fed switch <switch number> fwd-asic register read register-name SifRacDataCrcErrorCnt  
show platform hardware fed switch <switch number> fwd-asic register read register-name SifRacRwCrcErrorCnt  
show platform hardware fed switch <switch number> fwd-asic register read register-name SifRacPcsCodeWordErrorCnt  
show platform hardware fed switch <switch number> fwd-asic register read register-name SifRacInvalidRingWordCnt

C9K Walk through ROMMON mode campus/catalyst/c9k

set  
dir flash:  
cat flash:packages.conf  
set MANUAL_BOOT=no  
set BOOT=flash:<image>  
boot  
boot <filesystem>:<image>

Packet Forwarding campus/general

sdm prefer {vlan | advanced}

IOS-XE Output Drops campus/ios-xe

show int | i Ethernet.*is up|output drops: [1-9][0-9]*

Device Internal Error campus/management-appliance/catalyst-center/common-issues

#!/bin/bash
read -p "DNAC IP: " IP
read -p "DEVICE ID: " DEVICEID
read -p "Username: " USERNAME
read -p "Enter your password: " -s PASSWORD

TOKEN=`curl -X POST -u $USERNAME:$PASSWORD -s https://${IP}/api/system/v1/identitymgmt/token --insecure | jq '.Token' | tr -d '"'`
curl -X PUT -H "content-type: application/json" -H "X-AUTH-TOKEN:$TOKEN" -d "$DEVICEID" "https://${IP}/api/v1/network-device/sync-with-cleanup?forceSync=true" --insecure

General campus/management-appliance/catalyst-center

magctl appstack status
magctl service status <service>
magctl service restart -d <service>
magctl rbac external_auth_fallback display
magctl rbac external_auth_fallback enable
magctl rbac external_auth_fallback disable
magctl service logs -rf <service> | lql
magctl service logs -rf catalogserver | grep -i -e pull -e push -e download -e checksum -e layer -e connectdna -e allversion -e failed -e failure -e timeout -e exception -e meta -e exception -e checksum -e error | lql
$ maglev catalog settings display
$ maglev catalog release_channel display -V
$ maglev package status
$ maglev catalog system_update_package display   
$ maglev system_updater update_info
$ maglev system_updater update_info -s
   You can use the above command as a fallback and this is only available after the CLI is
 updated in SW 1.3+
$ maglev system_update_package status
$ maglev catalog package status system
$ watch -d -n 0.5 'maglev catalog system_update_package display'
$ watch -d -n 0.5 "maglev system_updater update_info"
$ watch -d -n 0.5 "maglev catalog package status system"
$ watch -d -n 0.5 "maglev system_update_package status"
maglev catalog package display
$ maglev package status | grep %
$ watch -d -n 0.5 "maglev package status | grep %"
$ magctl service logs -rf <upgrade related service name> | lql
$ magctl service logs -rf catalog | grep -i -e download -e pull -e push -e connectdna 
-e layer -e exception -e error | lql
$ magctl service logs -r system-updater | lql > system_updater.log
/var/log/maglev-node-updater-<node-name>.log
$ kubectl get node
maglev system_updater update_info
maglev catalog settings display
maglev catalog package display
maglev package status
magctl workflow status
magctl workflow revoke <ID>

magctl workflow status
magctl workflow revoke <ID>
maglev catalog settings display
magctl service unsetenv catalogserver PARENT_CATALOG_SERVER_REPOSITORY
magctl service unsetenv catalogserver PARENT_CATALOG_SERVER
magctl service unsetenv catalogserver PARENT_CATALOG_OVERRIDE
magctl service setenv catalogserver PARENT_CATALOG_SERVER_REPOSITORY dnac212
maglev catalog check_for_updates
maglev catalog package display
for package in $(maglev catalog package display -o json | jq -r '.[] | .name'); do maglev catalog package pull $package;done

Enhanced Tracking Object campus/other

track 2 ip route 2.0.0.0 255.0.0.0 reachbility
track 3 ip route 3.0.0.0/8 reachability
track 1 list boolean and 
 object 2 
 object 3
 object 4 not
track 4 list boolean and 
 object 2 
 object 3
track 5 list boolean and 
 object 6 
 object 7
! if (2 and 3) or (6 and 7)
track 1 boolean or
 object 4
 object 5

Packet Capture campus/other

monitor capture CAP interface xy both
monitor capture CAP match any

monitor capture CAP buffer circular
OR
monitor capture CAP file location flash:CAP.pcap

monitor capture CAP start 
monitor capture CAP stop
show monitor capture CAP buffer brief
debug platform software fed switch active inject packet-capture start
debug platform software fed switch active inject packet-capture stop
show platform software fed switch active inject packet-capture brief
show platform software fed switch active packet-capture brief
monitor capture cpuCap control-plane in match any file location flash:cpuCap.pcap  monitor capture cpuCap start
monitor capture cpuCap stop

BFD campus/routing

bfd interval <time in ms> mix-rx <time in ms> multiplier <number of missed packets>
router ospf <process id> area <number> 
ip ospf bfd
router eigrp <as> 
network 0.0.0.0 
bfd all-interfaces 
Or
bfd interface <interface id>
router bgp <as>
neighbor <neighbor IP> remote-as <as> 
neighbor <neighbor IP> fall-over bfd

BGP Purposefully Resetting Peer Connections campus/routing/bgp

R1# conf t 
Enter configuration commands, one per line. End with CNTL/Z. 
R1(config)# router bgp 123 
R1(config-router)# neigh 172.16.16.6 shutdown

BGP Disable Connected Check campus/routing/bgp/neighbors

neighbor <neigbor> disable-connected-check

BGP EBGP Multihop campus/routing/bgp/neighbors

neighbor <neigbor> ebgp-multihop <hops>

BGP Generalized TTL Security Feature (GTSM) campus/routing/bgp/neighbors

neighbor <neigbor> ttl-security hops <hops>

EIGRP Classic Basic Configuration campus/routing/eigrp/classic-mode

router eigrp <as>
  network 10.0.0.0 0.0.0.255

EIGRP Named Basic Configuration campus/routing/eigrp/named-mode

router eigrp <name>
 address-family ipv4 as <as>
  network 10.0.0.0 0.0.0.255

Routing Protocol Authentication campus/routing/general


interface <interface id>
ip ospf authentication [message-digest]
ip ospf authentication-key <key>
Or
ip ospf message-digest-key <key id> md5 <key>
router ospf <process id>
area <area id> authentication [message-digest] 

interface <interface id> 
ip ospf authentication-key <key>  
Or
ip ospf message-digest-key <key id> md5 <key>
router bgp <AS>
neighbor <ip address | peer group> password <password>
key chain <key chain name> 
key <key id>
key-string <secret key string> 
accept-lifetime <start time> [infinite | duration (seconds) | end time] <duration | end time>
send-lifetime <start time> [infinite | duration (seconds) | end time] <duration | end time>
interface <interface id> 
ip authentication key-chain eigrp <as> <key chain name>
ip authentication mode eigrp <as> md5
interface <interface id>
ip rip authentication key-chain <key chain name>
ip rip authentication mode <text | md5>

NHRP Map campus/routing/nhrp

ip nhrp map {tunnel-address-of-Hub} {NBMA-address-of-Hub}

OSFP Non-Broadcast campus/routing/ospf/network-type

interface Gig 0/0
 ip ospf network non-broadcast
router ospf 1
 neighbor 10.1.1.1
 neighbor 10.1.1.2
 neighbor 10.1.1.3
 neighbor 10.1.1.4

OSPF Point-to-Multipoint campus/routing/ospf/network-type

interface Tun 123
 ip ospf network point-to-multipoint

OSPF Point-to-Multipoint Non-Broadcast campus/routing/ospf/network-type

interface Tun 123
 ip ospf network point-to-multipoint non-broadcast

router ospf 1
 neighbor x.x.x.x

OSPF Point-to-Point campus/routing/ospf/network-type

interface Gig 0/0
 ip ospf network point-to-point

OSPF Authentication campus/routing/ospf

Internet Protocol Version 4, Src: 12.1.1.1, Dst: 224.0.0.5
Open Shortest Path First
    OSPF Header
        Version: 2
        Message Type: Hello Packet (1)
        Packet Length: 48
        Source OSPF Router: 0.0.0.1
        Area ID: 0.0.0.0 (Backbone)
        Checksum: 0xd292 [correct]
        *Auth Type: Null (0)
        Auth Data (none): 0000000000000000
    OSPF Hello Packet
    OSPF LLS Data Block
router ospf 1
 area <area-number> authentication

interface Gig x/y
 ip ospf authentication-key xxx
router ospf 1
 area 0 authentication message-digest

interface Gig x/y
 ip ospf message-digest-key <id> md5 <password>
key chain tst
 key 1
  key-string PSWD
  cryptographic-algorithm hmac-sha-512
interface g0/4
 ip ospf authentication key-chain tst
14:19:18.171: %OSPF-4-NOVALIDKEY: No valid authentication send key is available on interface OSPF_VL0
R3(config)#router ospf 1
R3(config-router)#area 1 virtual-link 0.0.0.2 authentication message-digest R3(config-router)#area 2 virtual-link 0.0.0.4 authentication message-digest

R4(config)#router ospf 1
R4(config-router)#area 2 virtual-link 0.0.0.3 authentication message-digest
area 1 virtual-link 0.0.0.3 authentication null

OSPF Best Path Selection campus/routing/ospf

router ospf 1
 compatible rfc1587

OSPF Default Route Injection campus/routing/ospf

default-information originate {always}
default-information originate route-map TEST
track 2 ip route 2.0.0.0 255.0.0.0 reachability
track 3 ip route 3.0.0.0 255.0.0.0 reachability
track 1 list boolean and
 object 2
 object 3

ip route 0.0.0.0 0.0.0.0 Null0 track 1

router ospf 1
 default-information originate
ip prefix-list NET permit 169.254.0.0/16

route-map tst permit 10
 match ip address prefix NET
 
router ospf 1
 default-information originate route-map tst

ip route 169.254.0.0 255.255.0.0 null0 track 1

OSPF Non-Broadcast Neighbor campus/routing/ospf

router ospf 1
 neighbor x.x.x.x cost 90

DTP Configuration campus/switching

switchport mode dynamic desirable.
switchport mode dynamic auto
switchport nonegotiate

MST - Troubleshooting campus/switching/stp

show spanning-tree mst configuration
show spanning-tree mst [instance-number]
show spanning-tree mst interface interface-id