Monday, October 29, 2018

Ever wanted to run Linux/python/perl apps on network switches? You can do it on Cisco 3Ks and 9Ks already

I had to go through exercise of figuring out how to run Ansible and DHCP on Cisco 9Ks and I figured I'd share my experiences in case somebody else needs to do the same. Quick summary is below and a little more detailed info you can find here: https://packetpushers.net/utilizing-linux-on-cisco-nexus-switches-how-and-why/

First of all, you want to do most of the work from guestshell - CenOS container that you need to first enable - "guestshell enable" and then connect to it with simply "guestshell".

How to run DHCP - great guide here: https://github.com/ndelecro/nx-os-programmability/tree/master/Guest_Shell/PXE_Server

How to run python/Ansible - pip install whichever package you want. If you don't have internet access from the switch, you can first download packages on the switch with internet access to the folder with " pip download f5-sdk -d packages/ ", copy them over to the switch and then install them from directory with " pip install f5-sdk --no-index --find-links file:packages/ ". Then you can just run your scripts normally, including all your Ansible playbooks.

Perl should work in a similar fashion, but unfortunately I don't have any experience with it.

It's nothing fancy, certainly not something I am comfortable constantly running in production, but can be useful in a pinch.



No comments:

Post a Comment