Cisco Support Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Announcements

Welcome to Cisco Support Community. We would love to have your feedback.

For an introduction to the new site, click here. If you'd prefer to explore, try our test area to get started. And see here for current known issues.

New Member

New VLAN+Ip address for about 1000 Switches

Hello,

i hope this is the right place to ask.

We have a lot Cisco Switches (in principle 2960, 2950, 2940) an now it's time to change the management VLAN of ~1000 Devices.

So we have to add a new VLAN interface on Every Switch, add a new IP like 10.108.XXX.3-X and set a new default gateway.

We got like 150 branches with different Ip addresses. For Example:

Switch 1 in Branch 1 will get the new IP: 10.108.0.3
Switch 2 in Branch 1 will get the new IP: 10.108.0.4

Switch 3 in Branch 1 will get the new IP: 10.108.0.5 and so on

Switch 1 in Branch 2 will get the new IP: 10.108.2.3

Switch 2 in Branch 2 will get the new IP: 10.108.2.4


Switch 1 in Branch 3 will get the new IP: 10.108.3.3
Switch 2 in Branch 3 will get the new IP: 10.108.3.4

So the third octet is different in every Branch.

There is actually a VLAN where an ip address is set like 10.230.111.3, 10.230.111.220 - XXX when the ip 10.230.111.3 is there the new ip in the new VLAN should be 10.108.0.3, when the ip 10.230.111.220 is there the new ip should be 10.108.0.4 and so on... 221 -> .5 222 -> .6

Is there a way to script this sh*t? I thought about expect Script but there is no way to read out some information and change the ip like i told.

I hope you understand the Problem.

Best regards

Daniel

2 ACCEPTED SOLUTIONS

Accepted Solutions
VIP Purple

I'm old school, so I would

I'm old school, so I would use perl.  If you are a bit younger you might use Python (its trendy at the moment).

I would probably do it in two parts.  I would write a script to dump the switch serial number to a file (you might also dump the current IP addresses).  Then I would pull it into a spreadsheet, and allocate all the IP addresses using a bit of drag and drop.  And then I would write a second script that applied the config change based on the switch serial number.

Another way I would consider doing it, using two parts again, is to write a script that walked across every switch backing up the configs to a central web server (hmm, backups, that sounds nice).

Then write a script to walk across every stored config on the server updating them.  Then I would check a whole bunch to make sure I was happy.

And then I would write a script to walk across all the switches and download the configs back onto the switch.  This would help you avoid getting locked out part way through a change as well.

New Member

Hi Daniel:

Hi Daniel:

Are you still looking for a way to script this?  Will you have a consistent mapping of second and third octets?  For the new management IP addresses, will the second octet always be 108?  And does the third octet increment by one in both the old and new IP addresses?  For example, will your old and new IP addresses look like this?

Old                        New

10.230.111.3        10.108.0.3

10.230.111.220    10.108.0.4
10.230.111.221    10.108.0.5

10.230.112.3        10.108.1.3

10.230.112.220    10.108.1.4

10.230.113.3        10.108.2.3

10.230.113.220    10.108.2.4

etc.

If so, I think that this can be done with Expect. 

Rich

3 REPLIES
VIP Purple

I'm old school, so I would

I'm old school, so I would use perl.  If you are a bit younger you might use Python (its trendy at the moment).

I would probably do it in two parts.  I would write a script to dump the switch serial number to a file (you might also dump the current IP addresses).  Then I would pull it into a spreadsheet, and allocate all the IP addresses using a bit of drag and drop.  And then I would write a second script that applied the config change based on the switch serial number.

Another way I would consider doing it, using two parts again, is to write a script that walked across every switch backing up the configs to a central web server (hmm, backups, that sounds nice).

Then write a script to walk across every stored config on the server updating them.  Then I would check a whole bunch to make sure I was happy.

And then I would write a script to walk across all the switches and download the configs back onto the switch.  This would help you avoid getting locked out part way through a change as well.

New Member

Thank you.

Thank you.

I did it with Python.

New Member

Hi Daniel:

Hi Daniel:

Are you still looking for a way to script this?  Will you have a consistent mapping of second and third octets?  For the new management IP addresses, will the second octet always be 108?  And does the third octet increment by one in both the old and new IP addresses?  For example, will your old and new IP addresses look like this?

Old                        New

10.230.111.3        10.108.0.3

10.230.111.220    10.108.0.4
10.230.111.221    10.108.0.5

10.230.112.3        10.108.1.3

10.230.112.220    10.108.1.4

10.230.113.3        10.108.2.3

10.230.113.220    10.108.2.4

etc.

If so, I think that this can be done with Expect. 

Rich

46
Views
0
Helpful
3
Replies