cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
751
Views
0
Helpful
7
Replies

Macro Vlan help

Rupesh Kashyap
Level 1
Level 1

Hi, I have configured MACRO on the switch. I have little bit confused. Should I give number in Vlan (vlan $V). I am seeing only Dollar Sign in the configuration. Please help.

macro name Port

switchport mode access

switchport access vlan $V

spanning-tree portfast

spanning-tree bpduguard enable

storm-control $T level $L

7 Replies 7

Giuseppe Larosa
Hall of Fame
Hall of Fame

Hello Rupesh,

it is like a subroutine in a programming language.

$V, $T $L represent the parameters that are to be passed when calling the macro

see

http://www.cisco.com/en/US/docs/switches/lan/catalyst3750/software/release/12.2_44_se/configuration/guide/swmacro.html

you need to use the following to call the macro

macro global {apply | trace} macro-name [parameter {value}] [parameter {value}] [parameter {value}]

using a special character to indicate variables is used in scripting languages like TCL and Perl.

Hope to help

Giuseppe

Leo Laohoo
Hall of Fame
Hall of Fame

When you run the macro Port, the command I would enter is this ...

macro apply Port $V 192 $T 3 $L 2

This means that $V or VLAN is assigned to VLAN 192 and so on.

In my Macro, my VLAN ID is always a variable. Who know what VLANs I'm going to use.

Hope this helps.

Thanks you guys. You have solved my confusion. What about, if I mention VLan Number in Macro, rather than using any Dollar sign ?

What is the difference if apply Globally or on Interface ?

Hi, below macro "port" is for Interface level. Can I apply this macro Globally, I tried but it is showing me error. It is working fine if applying on interface, please suggest-

macro name Port

switchport mode access

switchport access vlan $V

spanning-tree portfast

spanning-tree bpduguard enable

storm-control $T level $L

Hi Rupesh,

You can't apply this Globally because the commands are interface-level command.

Hope this helps.

thanks boss.

Review Cisco Networking for a $25 gift card