cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
5090
Views
0
Helpful
4
Replies

HELP: changing vlan with a script

idan.shemeah
Level 1
Level 1

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.

4 Replies 4

cadet alain
VIP Alumni
VIP Alumni

Hi Idan,

You can use switch macros to do this.

http://www.cisco.com/en/US/docs/switches/lan/catalyst3550/software/release/12.2_25_see/configuration/guide/swmacro.html

Regards.

Alain.

Don't forget to rate helpful posts.

Thanks for the advice, but the solution presented here is still not answer me about the problem for which I want to make this script.
I want to simplify the handling of changing the VLAN to employees who do not know how to work with switches.
By the solution you presented, employees will need to log in using TELNET to the switch and working with macros commands.

idan.shemeah
Level 1
Level 1

Someone help please ?

themhuyen
Level 1
Level 1

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

Review Cisco Networking for a $25 gift card