Can we programmatically read and change a CISCO router's configuration
via the CONSOLE port using TELNET or HYPERACCESS? Can we
programmatically read and change its configuration via the AUX port?
Among CONSOLE, AUX and LAN, which method achieves the fastest response
time? Which steps do I have to go through in order to compare response
times by using the tasks of reading the routing table and adding a
static route? |
Request for Question Clarification by
webadept-ga
on
01 Jun 2003 09:44 PDT
Although there are general answers to this, it would help if we had
the model and type of your router. This way we could be more specific
with your answer.
webadept-ga
|
Clarification of Question by
twbarrel-ga
on
02 Jun 2003 15:30 PDT
The router I want to configure is a CISCO 2611
twbarrel
|
Clarification of Question by
twbarrel-ga
on
05 Jun 2003 19:07 PDT
Hi webadept,
Can you still help me with my question? Please, let me know if you
need further clarification!
twbarrel
|
Clarification of Question by
twbarrel-ga
on
09 Jun 2003 16:12 PDT
Hi everybody,
I can't believe that nobody can help me with my question! Is it really
so difficult?
twbarrel
|
Hi twbarrel-ga,
You can connect a PC to the console port of the router with a rollover
cable. Here is a link for the pinouts for this connection. (Note:
Cisco routers will come with an adapter to make a direct PC to router
connection.)
http://www.cisco.com/warp/public/779/smbiz/service/knowledge/pinouts/ios_conaux.htm
To connect to the console port, you would need to connect with a
serial port communications program, like you mentioned with
HyperAccess, at the setting of 9600 8N1 and the Flow Control set to
None. Your terminal emulation should be set to VT100. (In Linux, you
could use a program called MiniCom)
With the two programs mentioned above, to "programmatically" read and
change your routers configuration you can write VB Scripts (with
HyperAccess) and Minicom, in Linux, has the ability to run scripts
within it. Also a note on HyperAccess from their site
(http://www.hilgraeve.com/hyperaccess/win32/index.html), you can use
their API to write your own program with Visual Basic, VBS, VBA, C++,
or Java to do this task.
With telnet, you would need to connect to the router through a LAN. If
your router is already configured for the network it is on, then you
would only need to telnet to its IP address and go from there. The
program HyperAccess can be used to telnet, so you would be able to
apply the same scripting with very little changes from serial
communications. With Linux, I would write a shell script to use telnet
and run the various commands needed while sending all output to a file
for review.
As I am not sure where you are going with this question, for example
if you are looking for someone to write the scripts for you or if you
need the commands to run, I will try to give you as much information
from the question provided.
Commands to get configuration:
Connect to router via the above mentioned methods...
<May need a password here if it is set>
en - To put you into enable mode
<May need a password here if it is set>
show version - Display the host name and version information about the
software running on the router
show running-config - Display the configuration information currently
running on the terminal.
show ip route - Display summary information about entries in the
routing table.
etc...
All of the show commands can be seen here -
http://www.cisco.com/univercd/cc/td/doc/product/atm/c8540/12_0/4a_11a/command/show.htm
Commands to change static routes:
Connect to router via the above mentioned methods...
<May need a password here if it is set>
en - To put you into enable mode
<May need a password here if it is set>
config t - To enter global configuration mode.
ip route 10.0.0.0 255.0.0.0 156.131.10.254 - example...
copy run start - Save information to routers startup in case router
needs to be bounced.
As for response time, the fastest and safest connection would be
direct serial to router connection, as there would be no network
congestion, or LAN traffic to hinder your speed if youre sharing your
connection through switches. If there is no network congestion, the
fastest connection would be a telnet LAN connection, however this
isnt the safest approach to configuring a router. To time it, I am
sure HyperAccess has a connection timer you can watch. If you script
it out in Linux, you can use the "time" command.
If you have any questions about the information I have provided, feel
free to request a clarification of my answer. Please be sure to give
me enough time to respond before you rate this answer.
Thanks so much!
chellphill-ga |
Request for Answer Clarification by
twbarrel-ga
on
10 Jun 2003 21:15 PDT
Thank you for the useful and detailed answer! Up to this point, Im
able to automatically open HyperAccess -by running a Java program- and
enter the routers configuration mode to any point I want (for
example, to the "telnet" prompt), using "copy run start".
My goal is to dynamically open and configure a 2611 Cisco router to
provide Quality of Service and see the difference in time cost between
Console/Auxiliary ports (using HyperAccess in both cases), and
Ethernet port ("telnet" through the network). So, I need a script that
measures the router processor time cost. The Perl script is a good
choice to do it, but I cannot use it in HyperAccess, and I think that
for dynamically opening the console I can only do it using
HyperAccess. The problem is that HA uses only VB scripts and
Javascripts. I think that I need to make scripts in HyperAccess with
many interactions. I would like a precise measure of time, but I dont
even know how to measure it from HyperAccess. The timer that you are
talking about, is not so obvious in the HA documentation.
Another issue is how to send in Java a JavaScript or VB script to
change the configuration of the router using the HyperAccess. Any
suggestion is very welcomed!
Thanks,
twbarrel
|
Clarification of Answer by
chellphill-ga
on
13 Jun 2003 15:21 PDT
Hi twbarrel-ga,
When you say "So, I need a script that measures the router processor
time cost."
What exactly are you referring to by this? Are you talking about path
cost? (Path cost, meaning a arbitrary value based on hop count,
bandwidth ect to compare different routes on a internetwork.)
|
Request for Answer Clarification by
twbarrel-ga
on
14 Jun 2003 16:01 PDT
Hi chellphill-ga,
By "time cost", I mean a measure of the time (in actual time units)
needed for the configurations' changes (that I want to implement
dynamically) to take place in both cases -i.e., through console (or
auxiliary) connection and through the ethernet connection- so I can
compare these times.
Regards,
twbarrel
|
Clarification of Answer by
chellphill-ga
on
21 Jun 2003 09:07 PDT
I have been pondering this question for a little while now and then it
hit me... You need to know the time spent running the scripts. All you
need to do is get the time at the start and then end of your scripts,
subtract, then you have (in seconds if you wish) time spent running
said script.
If you go the javascript route, here is a good site with a great
selection of example usages of the Date() function:
http://developer.irt.org/script/date.htm
I would do something like this is javascript:
--code--
secStart = new Date();
-- Your config code here --
secEnd = new Date();
secTotal = (secEnd secStart)/1000;
--end code--
That would give you the time in seconds on how long your script took
to run.
If you go the VBScript route, it looks like the now function is
something you would need.
A site that defines the now function:
http://www.nbu.bg/webstudio/spraw4nici/VBScript/now.html
I normally don't do VBScript, but I figured out this little script to
test out the theory. All it does is wait for 3 seconds and then put up
a msgbox dialog saying how many seconds it ran. (Not something you
would use in your script verbatim, but it gives you an idea)
-- code --
Option Explicit
Dim start
Dim ending
Dim total
start = Now()
WScript.Sleep 3000
ending = Now()
total = (ending start)/1000
MsgBox total
-- end code--
All in all, you would be taking the time at the start of the script,
the time at the end of the script. Take the end time and subtract the
start time from it. That would give you the total time spent running
your script. If the time is given in milliseconds, make sure you
divide that number by 1000 to get your seconds.
And in regards to your additional question of how to send in Java a
JavaScript or VB script to change the configuration of the router
using the HyperAccess, it is a bit outiside the scope of your original
question, and not something I deal with enough as to feel comfortable
in offering suggestions on. I would recommend that if you are still
seeking input on this, that you might want to post it as a new
question, so that a researcher who is more fluent in Java can address
the subject.
Thanks again, and best of luck to you!
chellphill-ga
|
Request for Answer Clarification by
twbarrel-ga
on
14 Jul 2003 13:38 PDT
Hi chellphill-ga,
I am sorry for this delayed reply to your last clarification, but I
left for vacation just one day before you sent it and I came back a
couple of days ago.
I finally managed to do what I had in mind, so I would like to thank
you for your help!
Best regards,
twbarrel
|
Clarification of Answer by
chellphill-ga
on
27 Jul 2003 19:21 PDT
It was a pleasure!
Best of luck to you!
chellphill-ga
|