cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
2786
Views
2
Helpful
3
Replies

Script to tests IP connectivity of devices using Ping.

Ayad
Level 1
Level 1

Dear all,

In order to check and ensure the IP connectivity of my hosts and devices in LAN, WAN, I have a batch script witch I execute from my computer and for each IP address in a list.txt file, I ping the address, i send the output to a result.txt.

when the executer of my file is finshed, i get the result.txt with the test connectivity status (reply or timeout).

For security reasons and from today, i will not have access to ping devices directy from my computer and then i must to telnet a cisco router where i can ping my hosts, devices.

- Does someone know is there any possibility to make a ping to a list of IP address from cisco 2620 router ? to cpoy list.txt in the flash ? send output to ftp/tftp,..?

- Does someone can help on how to open /close telnet sessions from batch files ?

I have found this script in the net, but i have problems to setup it :

========

use Net::Telnet::Cisco;

  my $session = Net::Telnet::Cisco->new(Host => '123.123.123.123');
  $session->login('login', 'password');

  # Execute a command
  my @output = $session->cmd('show version');
  print @output;

  # Enable mode
  if ($session->enable("enable_password") ) {
      @output = $session->cmd('show privilege');
      print "My privileges: @output\n";
  } else {
      warn "Can't enable: " . $session->errmsg;
  }

  $session->close;

=====

does someone can help on this ?

Thanks in advance,

Regards,

3 Replies 3

Joe Clarke
Cisco Employee
Cisco Employee

What you want is certainly doable, and this Perl script is one way to do it (using the Net::Telnet::Cisco module).  Others may suggest writting macros in various terminal applications.  However, there may be an embedded on-box solution you can do instead.  If your 2600 supports the Embedded Event Manager, you could have the device run a script which reads in an input file, performs the pings, then copies the results to your network server.  What version of code is this router running?

Hi Joseph,

the code version running is :

==

Cisco Internetwork Operating System Software
IOS (tm) C2600 Software (C2600-I-M), Version 12.2(1d), RELEASE SOFTWARE (fc1)
Copyright (c) 1986-2002 by cisco Systems, Inc.
Compiled Mon 04-Feb-02 06:25 by srani
Image text-base: 0x80008088, data-base: 0x8097F8EC

ROM: System Bootstrap, Version 12.2(6r),  RELEASE SOFTWARE (fc1)

R-TELNET-PHENIX uptime is 4 years, 51 weeks, 1 day, 21 hours, 14 minutes
System returned to ROM by power-on
System restarted at 15:51:03 UTC Sat Aug 6 2005
System image file is "flash:c2600-i-mz.122-1d.bin"

cisco 2620 (MPC860) processor (revision 0x00) with 28672K/4096K bytes of memo
Processor board ID JAD06110LEV (290963760)
M860 processor: part number 0, mask 49
Bridging software.
X.25 software, Version 3.0.0.
1 FastEthernet/IEEE 802.3 interface(s)
32K bytes of non-volatile configuration memory.
8192K bytes of processor board System flash (Read/Write)

Configuration register is 0x2102

==

Please let me know if i use perl script to do this tasks and i have more than to 500 devices to ping , does the cisco 2620 router will support this commands ? is there a risk for a crush or something like this ?

- Must i send just 100 devices at a time ? or the router memory can support many ?

- what is the limit of ping command that can support the cisco 2620 router ?

Thanks in advance,

EEM is definitely off the table in this version of code.  You'd need at least 12.3(14)T to make use of it.

Vertainly trying to ping 500 hosts from you 2600 will put some load on it.  If this router is responsible for other, mission-critical tasks, I would strongly consider not using it for this.  In any event, when interacting with the CLI, you will only be able to ping one host at a time.

I haven't done any performance tests using CLI-generated ping commands, but there is another alternative for you.  You could use IP SLA or even the CISCO-PING-MIB to do what you want.  The advantage of both is that they can be configured via SNMP, so you wouldn't need CLI.  IP SLA (called Response Time Reporter or rtr in this version of code) would be a beeter choice, but given the low memory, I'm not sure if you'll be able to do 500 hosts.  However, because you schedule the IP SLA collectors, you can run multiple in parallel continuously.

More on IP SLA as a feature is available at http://www.cisco.com/go/ipsla .  You should also consult the command references for 12.2 mainline for specific syntax (all IP SLA commands will begin with "rtr" on your version of IOS).  The MIB which allows you to configure and monitor IP SLA collectors is the CISCO-RTTMON-MIB.

Getting Started

Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community:

Innovations in Cisco Full Stack Observability - A new webinar from Cisco