01-16-2012 04:40 AM - edited 03-07-2019 04:22 AM
i enabled smartport desktop macro on a port on a 2960 switch.
in the cli it added
switchport port-security aging time 2
switchport port-security aging type inactivity
what do these commands do?
i read about aging and it seems that after 2 minutes of inactivity the connected devices MAC adress would be removed from table.
does that mean that after 2 minutes i can connect a different device and the second device will now be the only device allowed?
what kind of security is that?
thanks
Solved! Go to Solution.
01-17-2012 04:31 AM
Hi Jacob,
Yes, you are correct. The above configuration would prevent attaching more than one end device to the port (using an additional switch, hub, access point, ...).
Best regards,
Peter
01-16-2012 07:39 AM
hi,
there are two types of aging you can configure:
1.)
absolute—the secure addresses on that port are deleted after the specified aging time.
2.)
inactivity—the secure addresess on this port are deleted only if the secure addresses are inactive for the specified aging time.
you have "inactivitiy" configured, which means that after 2 min(the time you have specified) the secure mac addresses are deleted.
this feature is useful if you want to grant access only for a certain time.
florian
01-16-2012 12:41 PM
thanks
what happens if the original device becomes active again after two minutes ?
or if i connect a different device after two minutes?
01-16-2012 11:35 PM
should depend on what you have configured in the first place with the "switchport port-security mac-address" command.
if you have configured static entries, then i guess either no device will be able to connect on this port anymore, or dynamic learning is used.
if you have configured dynamic entries with the "sticky" command then i would say the port will learn new mac addresses up to the max. number of mac addresses you have allowed on that port.
but never tried this myself so iam not sure.
csco, if you have the switch, just try it, as this is tested within 10min.
if you test let me know about the result.
someone else has experience about this?
florian
01-17-2012 12:08 AM
Hello Florian and Jacob,
You have to remember that port security is about
The first task is much more visible and prominent: you have a set of "allowed" (secure in Cisco parlance) MAC addresses, all other MAC addresses are disallowed on a port. These MAC addresses may either be configured statically, or learned dynamically, or learned dynamically and automatically added to the configuration (sticky).
The port does not care about the types of secure MAC addresses. If you have configured a maximum of 5 secure MAC addresses on a port and already added 2 of them statically, another 3 can always be learned dynamically on the fly. A security violation would ensue if there were already 5 secure MAC addresses in place, and a frame with yet another source MAC address came in, or if some of these 5 secure MAC addresses suddenly appeared as a source MAC of a frame received on a different secure port.
About aging - Florian is absolutely correct about the absolute and inactivity aging types. An important thing, again, to remember that aging is relevant in situations where the port remains connected. If a port gets disconnected and goes down, dynamic secure MAC addresses are flushed immediately (static and sticky secure MAC addresses will be retained). Hence, the configuration as added by Jacob makes sure that even if the port remains up, an inactive dynamically learned secure MAC address will be flushed after 2 minutes.
So, to Jacob's question:
what happens if the original device becomes active again after two minutes ?
or if i connect a different device after two minutes?
Nothing special will happen. If the port does not get disconnected, the dynamically learned secure MAC address will be flushed. Whichever device comes in after two minutes, its MAC address will be learned and it will be allowed to communicate.
If the port does get disconnected, the dynamically learned secure MAC address will be flushed immediately. A device will be allowed to communicate immediately after plugging it back (provided the maximum count of secure MACs has not already been used up by static/sticky secure MAC addresses).
In order to stop speculating into great depths, Jacob - would you mind posting the entire configuration of your interface?
Best regards,
Peter
01-17-2012 12:26 AM
thanks peter.
here is the config
interface GigabitEthernet1/0/1
switchport mode access
switchport port-security
switchport port-security aging time 2
switchport port-security violation restrict
switchport port-security aging type inactivity
macro description cisco-desktop
spanning-tree portfast
spanning-tree bpduguard enable
!
the config was created by smartport desktop macro
i would like to understand what security such a config gives me,
and when you say "the port gets disconnected" do you mean physicaly or by by setting
01-17-2012 12:43 AM
Hello Jacob,
This configuration means:
In other words, this configuration always allows at most a single device to access the network via the Gi1/0/1 port. The MAC address of this device will be flushed after 2 minutes of inactivity (this is actually relevant only if another switch was connected to the Gi1/0/1 port because a disconnection of the device on the second switch would not be noticed by your Gi1/0/1 port, and hence, there must be some limit after which old dynamic secure MAC addresses are removed - but if there is a device directly connected to the Gi1/0/1, after it is disconnected, the dynamic secure MAC will be flushed immediately).
and when you say "the port gets disconnected" do you mean physicaly or by by setting
Both. Either unplugging the cable or shutting down the port will result in dynamic secure MAC addresses being flushed.
Best regards,
Peter
01-17-2012 02:04 AM
Peter thanks for your patience.
if i understood correctly from your above post
the config would be usefull to block attempts to connect switches to the port
any other device would not have a problem.
is that so?
01-17-2012 04:31 AM
Hi Jacob,
Yes, you are correct. The above configuration would prevent attaching more than one end device to the port (using an additional switch, hub, access point, ...).
Best regards,
Peter
01-17-2012 04:45 AM
Thanks!
01-17-2012 12:35 AM
hi peter,
thanks a lot for your help.
but what if the mac-addresses were learned statically? would the aging process concern these addresses? or is it all about the dynamically learned ones?
florian
01-17-2012 12:47 AM
Hi Florian,
I am happy to join you guys.
but what if the mac-addresses were learned statically? would the aging process concern these addresses?
In a strict sense, MAC addresses are not statically learned but rather configured - but I get the point. You have a very good question: the aging process does not affect static secure MAC addresses unless the switchport port-security aging static command is configured.
Best regards,
Peter
01-17-2012 12:53 AM
hi peter,
you are right, i meant statically configured.
thanks for your answer, helped me to understand the whole thing better.
florian
01-17-2012 07:45 AM
hi peter,
would have one last question.
what would happend if you configure static mac addresses and also configure the "switchport port-security aging static" command on the switch.
after the static entries are aged out, would no device be able to connect to the port or would the switch dynamically learn mac addresses up to the specified max. number of mac addresses?
and is the command "switchport port-security aging" valid for dynamically learned and valid for mac´s learnd with the "sticky" command.
thanks.
florian
03-15-2018 07:56 PM
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide