Constraints: requires that the password is the same for all the devices, or you will need to add a few lines of code ...
Risk level: High. Be very careful with the entries, a wrong manipulation may freeze your entire network.
Linux knowledge required: Open/edit a file (vi file_name) and save modifications (Esc then :wq <enter>?.Run a script using the ./Scriptname command from the target folder.
What is the publip.sh script?
This script allows a network administrator to send Cisco commands on a number of selected remote devices (router, firewall, switch, Wireless Access Points ...), via SSH or Telnet (the script automatically handles both types of connection).
These command lines will initially be entered in a sequence, one command per line (as a batch or a configuration file), in a small file called commandes.txt (there is no size limit)
Enter all the IPs (or DNS alias) for the various devices on your network (there is no limit to the number of devices).
Finally, when running the script, you will be asked to enter a password, which in our case must be the same for all devices.
The script goes much further!
Indeed, it fully autonomous and can hangle connection errors, data entry and record changes in a log file. This script also identifies the equipment for which it is able to connect via SSH or Telnet and then it keeps an archive of the procedures generating critical errors (crash script, misinterpretation of a commanf by the equipment). The different types of errors are:
1 - Connection timeout
2 - Log-in error, wrong password
3 - DNS Alias or IP non-existent
4 - Crashes of the Expect script (create log file of the equipment)
5 - Remote Connection disabled
6 - Correct DNS alias but non-existent IP
7 - Equipment not Cisco (HP Procurve)
8 - Non-Cisco equipment (X1000)
9 - Non-Cisco equipment (Alcatel)
10 -Sent command not recognized by equipment
11 - Error not listed above ($?=1)
You will be able to operate on all your equipment at the same time and gather valuable information on your network!
The content of subsidiary files
You will need to enter the commands ... The file must for any changes to the router configuration start with "conf t" and by "end". Modifications must be performed in a hierarchical manner and do not forget to save your changes! Small example:
router ospf 100
network 184.108.40.206 0.0.0.255 area 0
ip ospf hello-interval 5
ip ospf dead-interval 20
area 0 authentication message-digest
Enter the IP or DNS alias of all the equipment involved: