This article explains how to configure mac limiting on non-ELS devices.
The different ways of setting a MAC limit on non-ELS devices are:
To configure MAC limiting for port security by setting a maximum number of MAC addresses that can be learned on interfaces.
[edit ethernet-switching-options secure-access-port] user@switch# set interface <interface-name> mac-limit <limit>
When no action is specified for configuring the MAC limit on an interface, the device performs the default action drop if the limit is exceeded.
[edit ethernet-switching-options secure-access-port] user@switch# set interface <interface-name> vlan <vlan-name> mac-limit <limit>
With this type of configuration, the device drops any additional packets if the limit is exceeded, and also logs a message.
[edit ethernet-switching-options secure-access-port] user@switch# set interface all mac-limit <limit>
When no action is specified for configuring the MAC limit on all interfaces, the device performs the default action drop if the limit is exceeded:
You must clear existing entries in the MAC address forwarding table prior to changing the MAC address limit. To configure MAC limiting for port security by specifying allowed MAC addresses:
[edit ethernet-switching-options secure-access-port] user@switch# set interface <interface-name> allowed-mac xx:xx:xx:xx:xx:xx user@switch# set interface <interface-name> allowed-mac yy:yy:yy:yy:yy:yy user@switch# set interface <interface-name> allowed-mac zz:zz:zz:zz:zz:zz
[edit ethernet-switching-options secure-access-port] user@switch#set interface all allowed-mac xx:xx:xx:xx:xx:xx user@switch#set interface all allowed-mac yy:yy:yy:yy:yy:yy user@switch#set interface all allowed-mac zz:zz:zz:zz:zz:zz
You must clear existing entries in the MAC address forwarding table before you can change the MAC address limit. MAC limiting for a VLAN restricts the MAC addresses that can be learned for that VLAN, but does not drop the packet. Therefore, setting the MAC limit on a VLAN is not considered a port-security feature. The configuration of specific allowed MAC addresses does not apply to VLANs.
Limit the number of dynamic MAC addresses on a VLAN: If the MAC limit on a specific VLAN is exceeded, the device logs the MAC addresses of packets that cause the limit to be exceeded. No other action is possible.
[edit vlans] user@switch# set <vlan-name> mac-limit <limit>
Note: When you are applying a MAC limit on a VLAN, do not set mac-limit to 1 for a VLAN composed of Routed VLAN Interfaces (RVIs) or a VLAN composed of aggregated Ethernet bundles using LACP. In these cases, setting the mac-limit to 1 prevents the device from learning MAC addresses other than the automatic addresses:
If the VLAN is composed of regular access or trunk interfaces, you can set the mac-limit to 1 if you choose to do so.
https://www.juniper.net/documentation/us/en/software/junos/security-services/topics/topic-map/configuring-mac-limiting.html
https://www.juniper.net/documentation/us/en/software/junos/security-services/topics/topic-map/configuring-mac-limiting.html#d96e126