2

I need to simply configure switch ports which are similar:

switchport mode access
switchport access vlan XX
switchport voice vlan YY
spanning-tree mode portfast

I'm asking about using Smartports Macro port configurations which act as a port profile or template, are there any problems with this?

2
  • 1
    By the way, you may just want to use the global portfast and bpdu-guard commands rather than putting those on the individual ports. They only affect access ports unless used with the trunk keyword.
    – Ron Maupin
    Oct 2 '15 at 23:15
  • Do you have a good way to correctly identify the devices you want to configure the connected ports?
    – cpt_fink
    Oct 4 '15 at 4:33
3

The Cisco interface range command is really a macro that allows you to configure the same commands on a range of interfaces, and they don't necessarily need to be contiguous.

Example:

spanning-tree portfast default
spanning-tree portfast bpduguard default
!
interface range GigabitEthernet1/0/1 - 24 , 35 , 48
 description ACCESS PORT
 switchport access vlan 10
 switchport voice vlan 20
 switchport mode access
 storm-control broadcast level 5.00
 ip dhcp snooping limit rate 50
 queue-set 1
 srr-queue bandwidth share 1 30 35 30
 priority-queue out
 mls qos vlan-based
 load-interval 30

Edit, excerpt from the Cisco Press CCNP Practical Studies: Switching

Cisco has recognized the administrative overhead of this common task on Cisco IOS-based switches and has introduced a new global configuration command interface range that allows you to apply commands to a range or list of interfaces at the same time. This command is actually a macro, which means that when used, the macro actually invokes a series of commands. This process is transparent to the administrator. The configuration file contains no reference to the interface range macro; instead it displays each of the configuration commands invoked by the macro.

Edit based on you comment about Auto Smartport Macros:

The Auto Smartport Macros can be useful if you often connect/disconnect various types of devices in a large network. You want to make sure it's worth your while since you may be supporting multiple configuration types, some of which may never get connected to a particular switch.

Many companies consider this a security risk because they want unused ports disabled, not available every time someone wants to just plug in a random device. Static macros are more secure in that regard, not automatically reconfiguring a port to accommodate a switch or router that an end-user bought at a local store and just plugs in.

Keep in mind that if you use this for connecting network infrastructure devices like switches or routers, whoever is making the connections may accidentally connect to the wrong port, and everything seems to come up and work correctly, but it doesn't match your documentation.

You may find that creating and maintaining these macros is is worth the effort, or you may find it is a lot of work for little gain.

7
  • sure i know , i think in macro cause in change in the network in future to be more easy . so instead of apply all those lines under the interface just create macro and apply it to the interface
    – Gadeliow
    Oct 2 '15 at 23:33
  • The interface range command is a macro that repeats the same command for every interface in the range. I just copy and paste the commands under the macro, and it sets up all the ports that way.
    – Ron Maupin
    Oct 2 '15 at 23:37
  • See my edit. The interface range macro is a built in macro.
    – Ron Maupin
    Oct 3 '15 at 0:02
  • i'm not talking about this type of macros but macro configuration in this link cisco.com/c/en/us/td/docs/switches/lan/catalyst2960/software/…
    – Gadeliow
    Oct 3 '15 at 12:59
  • Sorry, you were not at all clear about a specific macro type.
    – Ron Maupin
    Oct 3 '15 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.