Using macros with IOS
September 11th, 2008
No comments
Ever wanted to do something on a Cisco switch, but you cannot because the action will throw yourself out? I had it recently when I want to activate a new SVI on a Catalyst 2950. Since there can be only 1 SVI active at a time, a decided to do this with a macro. A macro can be placed in the switch, and can be applied manually. When it is applied, you will be sure the script runs from begin to end, without interruption.
I have used the following script;
macro name change_vlan
interface Vlan1
no desc
no ip address
shutdown
interface vlan250
description production
ip address 10.101.3.1 255.255.255.0
no shutdown @
To apply the macro, you have to enter;
switch(config)# macro global apply change_vlan