Re-using 2950 configurations in 3560-X

Re-using 2950 configurations in 3560-X

20150910_190201

My company decided to upgrade the network changing 2960 switches by 3560X.
We have almost 100 2960.
We update the version of IOS to c3560e-universalk9-mz.150-2.SE7 too
The procedure that we use to make the migration was the following
1.-We connect to each 2960 and execute the command “show running” in such way the actual configuration is in the log of tty emulator
2.-We save each configuration in a file with a meaningful name (e.g. “lima_refrigeracion_1a”)
3.-Choose the most complex configuration, loading it on a 3560x and check the output .
4.-We have to erase the headers that were in the log (MOTD… commands…) etc.)
5.-Clearly find that we no longer had Fast ethernet now cards are Giga
6.-Also found changes in syntax so I wrote the following SED script to make all the changes in all files

#!/bin/bash
#
if [ “$1” == “–h” ] || [ “$1” == “–help” ];then
echo “# “
echo “# USAGE :   ~/converter  ”
echo “# You must be current in the dir that contain all the configurations”
echo “# the script create one dir (./new) and store the new configuration there with same name”
echo “#”
exit 1
#
for i in ` ls `
do
sed ‘ 1,/version/d ; s/FastEthernet/gi/g ; s/switchport mode trunk/switchport trunk encapsulation dot1q\n &/ ;  /^end/,$d ‘ $i  > ./new/$i
#
# 1,/version/d from line 1 to “version” delete
# s/FastEthernet/gi/g replace FastEthernet by gi globally
# s/switchport mode trunk/switchport trunk encapsulation dot1q\n &/ Same (replace) but adding a newline (\n) and the line replaced (&)
# /^end/,$d from the line beginning (^end) to end, delete (,$d)
#
done

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s