cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
1714
Views
0
Helpful
1
Replies

Python script for TACACs config 2911 router

PLC
Level 1
Level 1

Hi there, 

Appreciate any pointers here. 

 

I have to deploy tacacs configure for line con 0 and line aux. The configuration is as follows:

line con 0

login authentication no_tacacs

 

line aux 0

login authentication dial_in

 

aaa authentication login no_tacacs local * For console

aaa authentication login dial_in local * For Aux

 

I need to deploy this to all network (routers and switches) devices globally.

I never used python before. I am on windows 7 and have python 2.7.13 installed.  via youtube and google.com I got a rough draft script below but have no idea how deploy to my test router I have. the router is 2911 with no routing enabled. I have never done this in a test environment. 

Question 1. How can setup the router as a test router?

I have no routing protocol or static enabled and thought to only create a loopback with an IP configured for the vlan i am going to put it on that i can connect to via telnet on a production network. your thoughts?

 

Question 2.

I got a good start of the script below but not sure how to deploy with python. i need to add a part in the script to telnet by IP and port?  or do i put the IP where the "(HOST") is?

Thank you support community in advance!

 

 

 

tn = telnetlib.Telnet (HOST)
tn.read_until("Username: ")
tn.write("username\n")
if password:
tn.read_until("Password: ")
tn.write (password + "\n")


tn.write("enable\n")
tn.write (password + "\n")

tn.write("config t\n")
tn.write("aaa authentication login no_tacacs local\n")
tn.write("aaa authentication login dial_in local\n")
tn.write("line con 0/n")
tn.write("login authentication no_tacacs\n")
tn.write("line aux 0/n")
tn.write("login authentication dial_in\n")
tn.write("exit\n")
tn.write("exit\n")
tn.write("wr mem\n")

 

1 Reply 1

Francesco Molino
VIP Alumni
VIP Alumni
Hi

This is a duplicate post.
The link of the other post where I'll reply:
https://supportforums.cisco.com/t5/wan-routing-and-switching/python-config-help/m-p/3181970

Thanks

Thanks
Francesco
PS: Please don't forget to rate and select as validated answer if this answered your question
Review Cisco Networking for a $25 gift card