cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
3443
Views
5
Helpful
4
Replies

EEM 3.2 MAC Address prefix->switch port config examples

Jeremy Bresley
Level 4
Level 4

Have a interesting project that would require us to have a switchport change which VLAN it's configured to based on a specific device being plugged in.  Device has a unique MAC prefix for this manufacturer and would be plugged into a Cat4500 running 12.2(54)SG1 which has EEM 3.2.0.  Trying to figure out if it's possible to detect this MAC prefix and do the following IOS commands:

interface X/Y (based on which port the MAC is seen on)

switchport access vlan 500

Bonus points if there's a way to revert the interface back to another VLAN (could be statically assigned per switch) when the device is removed (link-down event?)

It looks like EEM 3.2 and higher are so new, that none of the examples I'm finding have it, and the mac-address-table information wasn't added until this release.  Any suggestions or pointers to examples using this functionality would be greatly appreciated.

4 Replies 4

Joe Clarke
Cisco Employee
Cisco Employee

This is certainly doable.  Let's say your OUI is 00:11:22.  This applet should do what you want:

event manager environment my_mac_oui 00:11:22

!

event manager applet detect-mac

event mat mac-address "^$my_mac_oui"

action 001 cli command "enable"

action 002 cli command "config t"

action 003 cli command "interface $_mat_intf_name"

action 004 if $_mat_notification eq "add"

action 005  cli command "switchport access vlan 500"

action 006 else

action 007  cli command "switchport access vlan 1"

action 008 end

action 009 cli command "end"

This functionality is similar to what would make a VMPS server? dynamically assigning vlans....

Similar to VMPS, yes.  But with EEM you have a lot more flexibility on what is configured on the ports.  This is more similar to Auto Smart Ports.  In fact, ASP uses EEM on the backend.

Nice, thank you Joe.

I know this thread is old but I have the same issue but for a bunch of MACs. I was looking to implement this with Auto SmartPorts but it seems that Cisco is pushing to use EEM better.

What modifications should I do to the above script for a group of MACs?

What about if I have also another group of macs that I want to change complete their port configuration if the device is connected and if the device is disconnected then change it back to the previous state?

Another questions, with ASP or EEM is a best practice to have all the access ports with their config empty or pre-configured with a "default vlan" that I want to have plus other configs and then later leave the script do it's thing?

Thank you in advance.