Showing posts with label macro. Show all posts
Showing posts with label macro. Show all posts

30 January, 2014

L2 and macro

#Create macro 
Switch(config)#
macro name L2_SEC
Enter macro commands one per line. End with the character '@'.
speed 100
 duplex full
 switchport mode access
 switchport nonegotiate
 switchport port-security
 switchport port-security maximum 1
 switchport port-security mac-address sticky
 switchport port-security violation shutdown
 no cdp enable
 spanning-tree portfast
 spanning-tree bpduguard enable
 ip dhcp snooping limit rate 5
@

Switch(config)#do show run | beg L2
macro name L2_SEC
speed 100
 duplex full
 switchport mode access
 switchport nonegotiate
 switchport port-security
 switchport port-security maximum 1
 switchport port-security mac-address sticky
 switchport port-security violation shutdown
 no cdp enable
 spanning-tree portfast
 spanning-tree bpduguard enable
 ip dhcp snooping limit rate 5

Switch(config)#interface range fa 0/5-6 
or
Switch(config)#define interface-range ACCESS fastEthernet 0/5-6
Switch(config)#interface range macro ACCESS

#Apply macro to interfaces
Switch(config-if-range)#macro apply L2_SEC

%Warning: portfast should only be enabled on ports connected to a single
 host. Connecting hubs, concentrators, switches, bridges, etc... to this
 interface  when portfast is enabled, can cause temporary bridging loops.
 Use with CAUTION

%Portfast will be configured in 2 interfaces due to the range command
 but will only have effect when the interfaces are in a non-trunking mode.

#Verify
Switch(config-if-range)#do show run interface fas 0/5
Building configuration...
interface FastEthernet0/5
 switchport mode access
 switchport nonegotiate
 switchport port-security
 switchport port-security mac-address sticky
 speed 100
 duplex full
 macro description L2_SEC
 no cdp enable
 spanning-tree portfast
 spanning-tree bpduguard enable
 ip dhcp snooping limit rate 5
end

Switch(config-if-range)#do show run interface fas 0/6
Building configuration...
interface FastEthernet0/6
 switchport mode access
 switchport nonegotiate
 switchport port-security
 switchport port-security mac-address sticky
 speed 100
 duplex full
 macro description L2_SEC
 no cdp enable
 spanning-tree portfast
 spanning-tree bpduguard enable
 ip dhcp snooping limit rate 5
end

04 December, 2013

Cisco CCNP Switch Chapter 3

#Selecting Ports To Configure

Range

Switch(config)# interface range fastEthernet 1/9 - 11
Switch(config-if-range)# shutdown

*Mar  1 00:17:50.367: %LINK-5-CHANGED: Interface FastEthernet1/9, changed state to administratively down

*Mar  1 00:17:50.375: %LINK-5-CHANGED: Interface FastEthernet1/10, changed state to administratively down
*Mar  1 00:17:50.379: %LINK-5-CHANGED: Interface FastEthernet1/11, changed state to administratively down

Switch(config)# interface range fastEthernet 1/12 , fastEthernet 1/14

Switch(config-if-range)# no shutdown
Switch(config-if-range)# shutdown

*Mar  1 00:19:24.579: %LINK-5-CHANGED: Interface FastEthernet1/12, changed state to administratively down

*Mar  1 00:19:24.587: %LINK-5-CHANGED: Interface FastEthernet1/14, changed state to administratively down

Macro

Switch(config)# define interface-range VLAN10 fastEthernet 1/0 - 4
Switch(config)# interface range macro VLAN10
Switch(config-if-range)# shutdown

*Mar  1 00:12:32.727: %LINK-5-CHANGED: Interface FastEthernet1/0, changed state to administratively down

*Mar  1 00:12:32.735: %LINK-5-CHANGED: Interface FastEthernet1/1, changed state to administratively down
*Mar  1 00:12:32.743: %LINK-5-CHANGED: Interface FastEthernet1/2, changed state to administratively down
*Mar  1 00:12:32.747: %LINK-5-CHANGED: Interface FastEthernet1/3, changed state to administratively down
*Mar  1 00:12:32.755: %LINK-5-CHANGED: Interface FastEthernet1/4, changed state to administratively down

Switch(config)# define interface-range VLAN5 fastEthernet 1/6 , fastEthernet 1/8

Switch(config)# interface range macro VLAN5
Switch(config-if-range)# shutdown

*Mar  1 00:15:45.783: %LINK-5-CHANGED: Interface FastEthernet1/6, changed state to administratively down

*Mar  1 00:15:45.787: %LINK-5-CHANGED: Interface FastEthernet1/8, changed state to administratively down

#Identifying Ports

Switch(config)# interface fastEthernet 1/0
Switch(config-if)# description PRINTER IN BLDG B, ROOM 12

Switch# show interfaces description | in Fa1/0

Fa1/0                          admin down     down     PRINTER IN BLDG B, ROOM 12

Switch#show interfaces status | include 1/0
Port    Name               Status       Vlan       Duplex Speed Type

Fa1/0   PRINTER IN BLDG B, disabled     50           half      10 10/100BaseTX

#Speed

Switch(config)# interface fastEthernet 1/0
Switch(config-if)# speed [ 10 | 100 | 1000 | auto ]

Switch# show interfaces fastEthernet 1/0 | include speed

  Auto-duplex, Auto-speed
Switch# show interfaces fastEthernet 1/0 | include BW
  MTU 1500 bytes, BW 100000 Kbit/sec, DLY 100 usec,

Switch#show interfaces status | include 1/0
Port    Name               Status       Vlan       Duplex Speed Type

Fa1/0   PRINTER IN BLDG B, disabled     50           half      10 10/100BaseTX

Switch# show running-config interface fastEthernet 1/0

!
interface FastEthernet1/0
 description PRINTER IN BLDG B, ROOM 12
 shutdown
 duplex half
 speed 10

#Port Duplex Mode

Switch(config)# interface fastEthernet 1/0
Switch(config-if)# duplex [ auto | half | full ]

Switch# show interfaces fastEthernet 1/0 | include duplex

  Auto-duplex, Auto-speed

Switch#show interfaces status | include 1/0
Port    Name               Status       Vlan       Duplex Speed Type

Fa1/0   PRINTER IN BLDG B, disabled     50           half      10 10/100BaseTX

#Reset an Interface to Default
R1(config)#interface fastEthernet 1/2
R1(config-if)#speed 10
R1(config-if)#duplex half
R1(config-if)#do show interface fa 1/2 | include duplex
  Half-duplex, 10Mb/s
R1(config-if)#exit
R1(config)#default interface fastEthernet 1/2
Building configuration...
Interface FastEthernet1/2 set to default configuration
R1(config)#do show interface fa 1/2 | include duplex

  Auto-duplex, Auto-speed

#Detecting Error Conditions
Switch(config)# errdisable detect cause [ all | cause-name ]
Switch(config)# errdisable detect cause bpduguard
Switch(config)# errdisable recovery cause bpduguard
Switch(config)# errdisable recovery interval  180 <30-86400> (sec)   86400=24H

Switch# show errdisable detect | include Enabled 
bpduguard            Enabled

Switch# show errdisable recovery | include Enabled

bpduguard            Enabled