Hi,
Apparently, we have some kind of heightened security on our cisco routers. Typically you could do the following:
Telnet Router
<enter password>
enable
<enter password>
However on our routers you have to do the following. Don't ask me why, it seems really stupid to me.
Telnet Router
<enter password>
login
<enter username>
<enter pasword>
enable
Anyhow, this is causing me serious problems when trying to use the NET::TELNET::CISCO perl module. Here is a snippet of what I am doing currently:
sub tftp_to_router
{
#connect a telnet session to the router
my $cisco_session=Net::Telnet::Cisco->new(Host=>$router);
#Login
$cisco_session->login($username,$password);
#Enable
$cisco_session->enable($password);
#ok we are in. Let's do our copy
#tftp the file over
#NONE OF THESE COMMANDS WORK BECAUSE AT THIS POINT, I AM
#CONNECTED TO THE ROUTER, BUT NOT IN ENABLE MODE
$cisco_session->cmd('copy tftp slot0');
$cisco_session->cmd('xxx.xxx.xxx.xxx');
$cisco_session->cmd('Source filename');
$cisco_session->cmd('Destination filename');
#Go to the directory on the router containing the startup-config file
$cisco_session->cmd('cd slot0:');
#Erase it
$cisco_session->cmd('erase startup-config');
#Copy the file we just tftp'd over to the startup-config
$cisco_session->cmd('copy source startup-config');
#Copy that file to the slaveslot0: too
$cisco_session->cmd('copy source slaveslot0:');
I tried adding the following before all the commands and it still did not work.
$cisco_session->cmd('login\nusername\npassword');
Any help would be appreciated.
Thanks,
Brian Whyte
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.