I have a port on a switch configured with port-security and sticky option.
interface FastEthernet0/18
...
switchport port-security maximum 2
switchport port-security
switchport port-security mac-address sticky
switchport port-security mac-address sticky 78e7.d1b4.8e14
switchport port-security mac-address sticky 0060.b955.c003 vlan voice
...
end
The IP phone is no longer connected to this port. If I show the MAC addresses on the port, both addresses are shown.
#show mac address-table int fa0/18
Mac Address Table
-------------------------------------------
Vlan Mac Address Type Ports
---- ----------- -------- -----
491 0060.b955.c003 STATIC Fa0/18
413 78e7.d1b4.8e14 STATIC Fa0/18
Total Mac Addresses for this criterion: 2
How can I view only the active MAC address, not including sticky addresses no longer there? show mac address-table dynamic
does not show the one still there because it is now static
due to being recorded by the sticky statement.
By active, I mean that the device is still connected and sending packets on that port – as opposed to just still be recorded as a sticky mac address.
Netdisco, for example, is somehow able to tell the difference when it performs its macsuck operation:
select mac, port, active from node where port = 'FastEthernet0/18';
mac port active
78:e7:d1:b4:8e:14 FastEthernet0/18 true
00:60:b9:55:c0:03 FastEthernet0/18 false
Best Answer
As long as the MAC is statically assigned to the port, it will always appear in the tables. As far as the switch is concerned, it's always "active".
The only way to know it's there is to ping it, check the dhcp snooping tables, etc. MAC port learning will not work.