




|
Tech Tips3
How to utilize bash shell script to automatically obtain Cisco Switch and
Router configuration? Author: Ben|Date: 2007/06/04|Back to Tech Tips
To obtain Cisco Switch and Router configuration automatically, we can compile one bash shell script combining UNIX CRON to backup configuration regularly:
#!/bin/bash router=10.10.10.10 password=cisco enable_mode='enable' enable_password=cisco term_length="terminal length" cmd='show run' echo open $host sleep 1 echo $password sleep 1 echo $enable_mode sleep 1 echo $enable_password sleep 1 echo $term_length 0 sleep 1 echo $cmd sleep 1 echo $term_length 24 sleep 1 echo exit 如果以上的程式名稱為telnet.sh,我們便可以在命令提示字元(prompt)下達指令: ./telnet.sh | telnet 就可以得到IP位址為10.10.10.10的Cisco交換器或是路由器的組態設定了。 |