Feeds:
Posts
Comments

Posts Tagged ‘Cisco’

Awhile back, I posted a simple expect script for automating SSH sessions on a Mac.  Here is a similar script for automating telnet sessions.

As with the SSH script, create a text file using the naming convention of your choice and .sh for the extension.  In the file, type the following:

expect -c  ‘spawn telnet <ip-address>
expect “Username:”
send “<username>\r”
expect “password:”
send “<password>\r”

That is all you need to log in.  If you need to add an enable password, add the following to the script:

expect “>”
send “enable\r”
expect “password:”
send “<password>\r”
interact’

And there you have it.  If you want to log the output to a file, create a file to receive the output and then append the following to the last line:

| tee -a /path/filename.txt

Let me know if you find this helpful.

Read Full Post »

I have been putting together a complex lab in Dynamips/Dynagen and running into an error.  The error message on the dynamips console read something to the effect of dynamips error: 203-Bad number of parameters (1 with min/max=2/2).  I searched the web for an explanation, but could not find one.  Finally, I think I have stumbled across the root cause.  If you have undefined parameters in your .net file, dynamips will throw this error for each undefined parameter.  For example, the config and idlepc values were undefined in my .net file, as seen here:

[[router R1]]
s0/0 = R7 s0/0
s0/1 = R2 s0/1
f0/0 = SW1 1
f0/1 = SW2 1
model = 3745
console = 2001
config =
idlepc =
[[router R2]]
s0/0 = R7 s0/1
s0/2 = R6 s0/2
f0/0 = SW1 2
f0/1 = SW2 2
model = 3745
console = 2002
config =
idlepc =

This is the .net file that caused the errors.  I could have sworn that I had run .net files without defining all the parameters before, but it did not work this time around. As soon as I removed those parameters, the .net file worked perfectly, as follows:

[[router R1]]
s0/0 = R7 s0/0
s0/1 = R2 s0/1
f0/0 = SW1 1
f0/1 = SW2 1
model = 3745
console = 2001
[[router R2]]
s0/0 = R7 s0/1
s0/2 = R6 s0/2
f0/0 = SW1 2
f0/1 = SW2 2
model = 3745
console = 2002

So, if you happen to be running into that error, check your .net file to see if there are any undefined parameters, then try deleting them.  Let me know if this is a help to anyone.

Read Full Post »

%d bloggers like this: