05-16-2011 05:08 AM - edited 03-04-2019 12:24 PM
Hello ,
I would be happy to have your help on this issue because I have trying for a lot of time to find a quick and easy solution, which unfortunately, I can not find.
I'm trying to write a simple script with which new employees, who have no knowledge of working with a Cisco switch, will use it to change certain ports from one VLAN to another VLAN.
I tried to deal with PERL program but it was too complicated.
I would appreciate you if you will help to build this script.
Thanks in advance,
Idan.
05-16-2011 05:40 AM
Hi Idan,
You can use switch macros to do this.
Regards.
Alain.
05-19-2011 01:57 PM
07-26-2011 07:29 AM
Someone help please ?
03-11-2012 08:01 PM
May be too late now, but this will do the job.
Note: This script is written for the NMS that runs on Solaris.
#!/bin/bash
#Written by Them Huyen - Australia.
#This script is to config the Cisco router/switch from a Solaris NMS.
#File hostname is a list of devices with 3 columns, seperate by the space: first column is the hostname/ip address
#+ the second column is the switch/router interface detail e.g. fa0/1, the 3rd column is the vlan info e.g 100
#File hostname should look like this: 10.0.0.1 fa0/1 100
#
cat hostname | while read host int vlan
do
ping $host >/dev/null
if [ $? = 0 ]; then
(echo "YOUR_LOGINID";\
echo "YOUR_LOGIN_PASSWD";\
echo "conf t",\
echo "interface $int";\
echo "switchport access vlan $vlan";\
echo "end";\
echo "show run int $int";\
echo "wri mem";\
echo
echo "exit";\
sleep 10) 2>/dev/null | telnet $host;
echo
echo "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
else
echo -e "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
echo -e "Device \"$host\" is unreachable"
echo -e "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
echo -e " "
fi
done | tee config-Result.txt
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide