cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
941
Views
3
Helpful
11
Replies

Python scripting in CML

ctmclain78
Level 1
Level 1

I am wanting to set up a lab to set up and run python scripts for learning purposes. I have tried this a few times but want to ask the community if there is a Best or recommended node to use to push the scripts to switches and routers. If this is too vague, I can be a bit more specific. 

11 Replies 11

Jens Albrecht
Spotlight
Spotlight

Hello @ctmclain78,

there are several ways to do this but my preferred way is to simply run the Python scripts directly on my host pc.

I use an external connector in bridged mode connected to an unmanaged switch, and then connect the management interfaces of the CML nodes to that switch. This allows direct access from my host pc to any CML node.

If you have more specific needs, feel free to let us know.

HTH!

Hi @Jens Albrecht ,

Thanks for the feedback. That is an interesting setup. I know I am probably missing something conceptually in my head. Forgive my ignorance but how do you connect the unmanaged switch to the CML node? I ask because I was connecting my system to CML over anyconnect and then and then bringing up the lab once connected.

Hi @ctmclain78,

just prepared a quick diagram of a typical layout that I use for such scripting labs.

24-09-2025_22-26-45.png

All CML nodes that I want to connect to via Python scripts get a management address in the 192.168.25.0/24 network so that I have direct connectivity from my Host PC.

This diagram only shows the management connections to improve visibility. Of course, the CML nodes have additional links between them for the lab setup itself.

HTH!

is there a specific node you chose as your 'host pc' and run python scripts from it? thanks and to everyone sorry for my ignorance. i should have started learning this stuff years ago

Martin L
VIP
VIP

Recommend Network Automation PC appliance ( free download for GNS3 ) with the course CCIE Mastering Python with David Bombai.  

MartinL_0-1758663648721.jpeg

Regards, ML
**Have fun labbing!!!***
***Please Rate All Helpful Responses ***

You can purchase the course from Udemy or do it yourself from following videos links

have fun!

my problem with gns 3 is the fee for the IOSv images. i am scared of the "free" versions on the internet. maybe i'll will get tired of futzing with cml and pay for the virl images and stick with gns3 if i can't get cml to work

 those are usually the same images; free or leaked 

balaji.bandi
Hall of Fame
Hall of Fame

CML 2.9 can now (or before) have Ubuntu as a node, and you can use VS Code to connect to Ubuntu for the Python virtual environment to learn Python scripting.

i use CML and other virtual labs for testing : 

https://www.balajibandi.com/?p=1415

BB

=====Preenayamo Vasudevam=====

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help

thanks @balaji.bandi are you planning to post the config and scripts mentioned on the page that you shared?

I am building an automation tool with a GUI using FastAPI and MCP server; it's not ready yet. You can see on my other pages that I  posted some screenshots. Once it's ready, I will share it on GitHub.

 

BB

=====Preenayamo Vasudevam=====

***** Rate All Helpful Responses *****

How to Ask The Cisco Community for Help