[Tutor] cisco router + telnetlib

Python python at venix.com
Thu May 25 00:54:07 CEST 2006


On Wed, 2006-05-24 at 18:18 -0400, Daniel McQuay wrote:
> Hello List,
> 
> I am rather new to programming and I was wondering y'all think the
> best way to configure a cisco router using python would be. currently
> I am using telnetlib. my problem is, I get an error after connecting
> to the router. here is the error I get when I use IDLE: 
> 

http://mail.python.org/pipermail/tutor/2006-March/045547.html
This is part of an earlier thread about configuring routers using a
script.

I'd recommend using tcpwatch to debug the connection.  The router may
have sent an error message before closing the connection.  Remember that
the router software was designed for human interaction.  tcpwatch will
allow you to see both sides of the conversation.

You'll see in the earlier thread that I'd also recommend using tftp to
send most of the commands and limit the interactive telnet script to:
	logging on
	running tftp
	logging off

> Enter IP: 205.180.0.3
> Warning: Problem with getpass. Passwords may be echoed.
> Router Password: cisco
> Warning: Problem with getpass. Passwords may be echoed.
> Router Secret: class 
> Enter Router hostname: RouterBob
> Traceback (most recent call last):
>   File "C:\Documents and Settings\bob\My Documents\Administration
> \Scripts\cisco_config.py", line 20, in ?
>     tn.write("hostname " + hostName + "\n") 
>   File "C:\Python24\lib\telnetlib.py", line 292, in write
>     self.sock.sendall(buffer)
>   File "<string>", line 1, in sendall
> error: (10053, 'Software caused connection abort')
> >>> 
> 
> I have also attached the script that I use. could you please point me
> in the right direction.
> 
> thank you in advance,
> 
> 
> -- 
> Daniel McQuay
> boxster.homelinux.org
> Dead Possum Productions
> 814.825.0847 
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
-- 
Lloyd Kvam
Venix Corp



More information about the Tutor mailing list