Reply

Cisco - Make Changes on Multiple Interfaces and Save Config

Authority
Posts: 20
5279     0

I am looking for a script example of how to make change across multiple interfaces and then save the changes once completed.  

 

I am looking to do something like the following:

 

config t

 

int gi0/1

  no switchport port-security

  no switchport voice vlan 30

 

int gi0/2

  

  no switchport port-security

  no switchport voice vlan 30

 

...  repeat for every port on the switch

 

end

 

write memory

 

=============

 

I am have trouble figuring out how to go int to configuration mode 1 time, iterate through all the interfaces and then finally end out and save the configuration before moving on to the next switch.

 

Questions:

 

1.  Are there any templated scripts that can do such a task?

2.  Should this be done in CCS or Perl?

 

Thanks ahead of time.

 

 

Re: Cisco - Make Changes on Multiple Interfaces and Save Config

Expert
Posts: 236
5280     0

NetMRI ships with a collection of sample scripts that incrementally show how to do exactly what you want.  Both CCS and Perl equivalents are included.  Start with Example5.ccs or Example5.pl.

Re: Cisco - Make Changes on Multiple Interfaces and Save Config

Authority
Posts: 20
5280     0

Thank you MAdkins.  Those scripts look promising.

Re: Cisco - Make Changes on Multiple Interfaces and Save Config

Techie
Posts: 6
5280     0

If you want to make the same changes to all interfaces and if the switch is Cisco why not use an interface range and change them all at once ? Heck you could do that with an ad hoc script quite easily.

 

Int range gi 0/1-48

no switchport port-security

  no switchport voice vlan 30

do wr mem

 

 

Re: Cisco - Make Changes on Multiple Interfaces and Save Config

Authority
Posts: 20
5280     0

BGroves, then the issue becomes how many line cards does a chassis have to formulate the correct range.

Re: Cisco - Make Changes on Multiple Interfaces and Save Config

Authority
Posts: 20
5280     0

Here is my final script to remove port security off every interface on a switch.  This seems to be a useble solution.

 

Script-Filter:
$V