Using NTCIThe Basics
Caveats and TipsUsing Errmode
Interface Name Harmony
Using NTCI on the Console
The SF.net Project Page
My new contributor Josh Kittle offered me access to some Cisco devices he had via console. I was very gratefuly, but I soon realized that I've never tried to run NTCI via console.
For those who've never run a console server, I'll fill you in on some detail of the workings of one. Stereotypically, a console server is a device that has a butt-load of serial connections on it that are used to provide console access to a bunch of devices. At work, we use a specialized device that's sole purpose is to provide console access for routers, switches, servers, SANs, etc. My previous employer used Cisco 2600s with NM-16As installed to provide 16 Asynchronous serial ports.
In any case, you only get a single IP address to connect to a bunch of devices. So, how do you get to individual boxes? You use a technique called reverse telnetting. That means that you telnet to a specific port on the console server based on the serial port you're connected to. For example, if your router is on serial port 5, you would telnet to port 7005 (or 2005 or 4005 or 3005 depending on what the console server is).
Great! Now we have access to all of Josh's devices using the Port key of the new hash in NTCI. We can use the login function as normal after we wake the device up and have it prompt us.
$connection = Net::Telnet::Cisco::IOS->new( Host => "188.8.131.52", Port => "7005" ); $connection->login( Name => "name", Password => "password" );But, if you've ever used a console of a Cisco router (or switch), you know that you get the "Press Enter to continue" message. I tried just sending the connection a newline ("\n"), but that didn't work. Then I discovered the "Send_wakeup" key of the new hash. This key sends the proper wakeup message to the device so you actually get a login prompt. The key can have one of two values: connect or timeout (or 0, if you're being picky). "Connect" says to wakeup the box when you connect. "Timeout" says to send a wakeup when you get timed out on the console. You probably figured that out.
Here's an example.
$connection = Net::Telnet::Cisco::IOS->new( Host => "184.108.40.206", Port => "7005" Send_wakeup => "connect");You can also call the "send_wakeup" method if you want. Easy stuff:
$connection->send_wakeup( "connect" );It's up to you to discover when you want to use a console server versus direct network access, but you can use NTCI to access your device over any the network and the console. Have fun.