Happy New Year & Resolutions for 2017

2016 is over, at least here in switzerland. It was an interesting year for me, i attend my first Cisco Live (@Vegas) and had to recertify my CCIE for the first time. As the new year starts i’m taking a new challenge @Netcloud as Network Engineer. I have different things that i want to accomplish in 2017.

Short Description
Run on 200 Days About 4 Days a week, this will be hard but should be doable
First Marathon Already booked, Berlin in September
Read 26 Books I will create a list and keep track of this on a separate post
Improve my Spanish I learned some basic Spanish skills last year and put them in use on my trip to central america, but i definitely want improve them!
Get my CCIE Datacenter I'm already working on this
Blog Redesign An easy one, but it's time for a new look

Error: Error executing command on leaf02. Error Code: 255

I had a issue today with running remote commands on one of my fabric switches, always generated an error.

apic1# fabric leaf02 show switchname
 Node 102 (leaf02)
Error: Error executing command on leaf02. Error Code: 255

I tried to directly connect and found the error

admin@apic1:attach leaf02
This command is being deprecated on APIC controller, please use NXOS-style equivalent command
# Executing command: ssh leaf02 -b
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that the RSA host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
Please contact your system administrator.
Add correct host key in /home/admin/.ssh/known_hosts to get rid of this message.
Offending key in /home/admin/.ssh/known_hosts:2
Password authentication is disabled to avoid man-in-the-middle attacks.
Keyboard-interactive authentication is disabled to avoid man-in-the-middle attacks.

Permission denied (publickey,password,keyboard-interactive).

I think this was the switch that i converted to NX-OS standalone mode, and thus it changed the host key.

The fix is easy, open the file and delete the offending key

vi /home/admin/.ssh/known_hosts

After that i was able to run commands from the apic and also connect to the fabric switch again.

Cisco ACI – Run Commands on the Switches from your APIC

With the introduction of the NX-OS like CLI Cisco also added the option to run commands on the switches directly from your apic. It’s now even easier to get some infos from one or multiple switches in your fabric.

Show switchname on a single fabric switch

apic1# fabric leaf01 show switchname
 Node 101 (leaf01)

You can also run commands on multiple devices

apic1# fabric leaf01, leaf02 show switchname
 Node 101 (leaf01)
 Node 102 (leaf02)

The list of possible commands is pretty long, just to give an idea

 aaa               aaa
 bfd               BFD commands
 bgp               Display BGP status and configuration
 cdp               Show Cisco Discovery Protocol information
 clock             Display current Date
 coop              Show information about coop
 copp              Control Plane Policing (CoPP) information
 copyright         Copyright information
 cores             Show all core dumps for the current vdc
 dhcp              Show DHCP
 diagnostic        Diagnostic commands
 dpp               Data Plane Policing (DPP) information
 eigrp             Display EIGRP status and configuration
 endpoint          End point
 environment       Environment Information
 fc2               Show fc2 information
 fcoe              Show FCOE paramaters
 fex               Show FEX information
 forwarding        Display mfdm information
 hardware          Show hardware information
 hostname          Hostname
 hsrp              HSRP information
 interface         Show interface status and information
 inventory         system inventory information
 ip                Display IP information
 ipmgr             Show information about ipmgr
 ipv6              Show IPv6 information
 isis              Display IS-IS status and configuration
 istack            Show istack information
 lacp              LACP protocol
 lldp              Show information about lldp
 locator-led       Blink locator led on device
 logging           logging information
 mac               Mac addr information
 mcp               Show information about mcp
 mfdm              Show MFDM information
 module            Module
 monitor           Show SPAN information
 npv               Show Npv information
 ntp               Show NTP information
 oam               Show information about oam
 ospfv3            Display OSPFv3 status and configuration
 port-channel      Show port-channel information
 porttrack         Port Tracking
 processes         Show processes
 radius-server     Radius-server
 redundancy        Show system redundancy status
 resource          Show resource configuration for VDC
 route-map         Route-map information
 routing           Display routing information
 san-port-channel  Show san-port-channel information
 service           Display service information
 snmp              Display SNMP information
 sprom             show SPROM contents
 stats_manager     Show information about stats_manager
 switchname        Show the system's hostname
 system            System-related commands
 tacacs-server     Tacacs-server
 tunnel            Show information about Tunnel
 users             Show users logged onto the system and their sessions
 vdc               Show information about vdc_mgr
 version           Show running firmware version and basic system information
 vlan              VLAN status
 vpc               Virtual Port Channel configuration
 vrf               Display VRF information
 vsan              Show vsan information
 zoning-filter     Display Zoning-Filter information
 zoning-rule       Display Zoning-Rule information

Cisco ACI – Connect to the leaf/spine switches with the NX-OS

Some time ago i posted how you can connect to a spine or leaf switch -> Connect to a leaf/spine switch
With the introduction of NX-OS, the syntax changed a bit. You have now first to drop back to the bash shell and then you can attach the switches. Password is still the same as for the APIC.

apic1# bash
admin@apic1:~> attach leaf01
This command is being deprecated on APIC controller, please use NXOS-style equivalent command
# Executing command: ssh leaf01 -b

Cisco Nexus Operating System (NX-OS) Software
TAC support: http://www.cisco.com/tac
Copyright (c) 2002-2016, 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

There is also the possibility to directly run show commands from the APIC.
Run Commands on the Fabric Switches from your APIC

Acitoolkit – Get all Nodes

Example script to print all your fabric nodes.

from acitoolkit.acitoolkit import Session
from acitoolkit.aciphysobject import Node

url = 'https://apic'
user = 'user'
pw = 'pw'

session = Session(url, user, pw)

nodes = Node.get(session)
for node in nodes:
    print('=' * 50)
    print('Pod: {}'.format(node.pod))
    print('Node: {}'.format(node.node))
    print('Mode: {}'.format(node.mode))
    print('Model: {}'.format(node.model))
    print('Vendor: {}'.format(node.vendor))
    print('Serial: {}'.format(node.serial))

Nexus 1000v – Port-Profile Error ‘MSP-5-PP_UPDATE_FAILED’

I tried to create a new port-profile on a Nexus 1000V and got the error

2016 Oct 14 10:33:35 N1Kv %MSP-5-PP_UPDATE_FAILED: Update of port-profile 'New-Port-Group' on the vCenter Server failed. Please  verify port-profile config.

This error can appear if you configure more max-ports on the port-profiles than you specified in the ‘svs connection vcenter’. In my case i had overprovisioned the port-profiles with ‘max-group 512’, so i just reduced the max-port on some port-profiles and this solved the issue.

Python – Building a Cisco Type 7 Decrypt Tool

I wrote a small python script that can decrypt cisco type 7 passwords.
Cisco7Decrypt on Github

You can decrypt password directly through the CLI:

→ python cisco7decrypt.py 12090404011C03162E

If you want the command accessible from anywhere, just link it to a folder that’s included in your Path. In this example ‘~/bin’

ln -sn `pwd`/cisco7decrypt.py ~/bin/cisco7decrypt

Docker MySQL Backup

We moved an internal tool to docker (docker-compose), this includes the required MySQL Database.
I looked for a easy solution todo a backup through mysqldump and found something great 🙂
This is the relevant docker-compose part:

     - back_net

If this docker-compose is running, the mysql container get the following name ‘ourtool_mysql_1’
The network gets the compose name added:

docker network ls
NETWORK ID          NAME                          DRIVER              SCOPE
4d42f74cfe7e        ourtool_pub_net    macvlan             local

We want our backups in the host folder /mnt/Backups/ourtool/sql (This is a nfs mounted folder).
Now we just put this information together:

docker run -it \
--net=ourtool_pub_net \
-v /mnt/Backups/ourtool/sql:/var/backup \
--rm mysql \
sh -c "exec mysqldump -h ourtool_mysql_1 -uroot -pYOURPASSWORD YOURDATABASE > /var/backup/mysql.dump"

That’s it, it runs, after that the temporary container gets destroyed and you can find the data on the host itself (‘/mnt/Backups/ourtool/sql’ in my case)

We now just run this as a cronjob

cat /etc/cron.daily/backup_ourtool

FILENAME="ourtool-`date -I`.sql"
docker run -it \
--net=ourtool_pub_net \
-v /mnt/Backups/ourtool/sql:/var/backup \
--rm mysql \
sh -c "exec mysqldump -h ourtool_mysql_1 -uroot -pYOURPASSWORD YOURDATABASE > /var/backup/$FILENAME"