This one has been getting to me for a few days now.. I'm trying to get some pre-configured macros on all my switches so when I perform an upgrade and I can just kick off these macros..
The goal of this macro:
1. Remove and shutdown vlan 1
2. create VLANs for users
3. Assign the ports to the desired VLANs
Here is a test macro I am working with:
define interface-range macro1 fa0/1 - 24
define interface-range macro2 gi0/1 - 2
macro name change_network2
interface Vlan1
no ip address
shutdown
interface vlan 11
description UserNetwork
ip address 192.168.1.2 255.255.255.0
no shutdown
interface vlan 99
description Null Interface for unused ports
ip address 172.160.1.2 255.255.255.0
no shutdown
Interface range macro macro1
switchport mode access
switchport access vlan 30
Interface range macro macro2
switchport mode trunk
switchport trunk native vlan 99
switchport trunk allowed vlan all
@
When I run this macro I get the following message:
% Command exited out of interface range and its sub-modes.
Not executing the command for second and later interfaces
Now it applies the configuration only to the first port in the interface range... but that's it. From the Cisco document
here it says this:
•Applying a macro to an interface range is the same as applying a macro to a single interface. When you use an interface range, the macro is applied sequentially to each interface within the range. If a macro command fails on one interface, it is still applied to the remaining interfaces.
So I assume this can be done... I just can't find much else on this.. I'm running this a Cisco 2960 IOS 12.2(44).. I suppose I can forget about the interface range command and list the individual interfaces but that doesn't seem right...
(I've also tried it without the define interface range and got the same results)
Any thoughts?