Warning: session_start(): Cannot send session cookie - headers already sent by (output started at /home/circui15/public_html/packetpros.com/index.php:4) in /home/circui15/public_html/packetpros.com/wp-content/plugins/wp-file-upload/wordpress_file_upload.php on line 2

Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/circui15/public_html/packetpros.com/index.php:4) in /home/circui15/public_html/packetpros.com/wp-content/plugins/wp-file-upload/wordpress_file_upload.php on line 2
Macro’s in Switches

I like using macro’s in switches. I find them useful since different customers have different requirements (for example ports that are not used). Here’s a couple of examples-

macro name UNUSED
default interface $interface
interface $interface
description UNUSED PORT
no macro description
no switchport
shutdown
exit
@

macro name AP
default interface $interface
interface $interface
switchport
switchport trunk encaps dot
switchport mode trunk
spanning-tree portfast trunk
no spanning-tree bpduguard enable
power inline auto
switchport trunk allow vlan 200,300,500
no shutdown
@

macro name PRINTER
default interface $interface
interface $interface
switchport
switchport mode access
spanning-tree bpduguard enable
power inline never
switchport access vlan 10
switchport port-security
switchport port-security maximum 1
switchport port-security mac-address sticky
power inline never
storm-control broadcast level pps 1k
storm-control multicast level pps 2k
storm-control action trap
no shutdown
@

So there’s three macro’s; UNUSED, AP and PRINTER. You’ll notice that each macro has a variable of $interface. We use that variable to determine what port to apply the macro to. For example we want to apply the UNUSED macro to port Gi2/0/24. We want to apply this in Global Configuration mode and not under the interface itself.

PACKET-SW(config)#macro global apply UNUSED $interface Gi2/0/24
Interface GigabitEthernet2/0/24 set to default configuration
PACKET-SW(config)#do sh run int gi2/0/24
Building configuration...

Current configuration : 104 bytes
!
interface GigabitEthernet2/0/24
description UNUSED PORT
no switchport
no ip address
shutdown
end