[cisco iOS] Use Macro Ping Scripts for Reachability Testing

For macro scripting on the Catalyst switches, we can take the same list of IP addresses used before and prefix them with the commands “do ping”. The resulting list in notepad should look like this.....

BEZH
March 9, 2015








do ping %{IPlist_1}%
do ping %{IPlist_2}%
do ping %{IPlist_3}%
do ping %{IPlist_4}%
do ping %{IPlist_5}%
do ping %{IPlist_6}%
do ping %{IPlist_7}%
do ping %{IPlist_8}%

! Next we can insert these commands as a sequence in a global macro as follows
! End with @ symbol

conf t
macro name PING_SCRIPT
do ping %{IPlist_1}%
do ping %{IPlist_2}%
do ping %{IPlist_3}%
do ping %{IPlist_4}%
do ping %{IPlist_5}%
do ping %{IPlist_6}%
do ping %{IPlist_7}%
do ping %{IPlist_8}%
@

! We now have a script named “PING_SCRIPT” that can be run from global configuration. To apply the script use the following syntax:

macro global apply PING_SCRIPT

Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to %{IPlist_1}%, timeout is 2 seconds:
!!!!!
Success rate is 100 percent (5/5), round-trip min/avg/max = 1/4/9 ms
Type escape sequence to abort.
Sending 5, 100-byte ICMP Echos to %{IPlist_1}%, timeout is 2 seconds:
!!!!!