Symptom
With MAC learning disabled globally and on the interface level we still see MAC is being learnt:
STLD1-630.02.02-N3K-RU35(config-if)# show run | i mac
mac-learn disable
switchport mac-learn disable
STLD1-630.02.02-N3K-RU35(config-if)# show mac address-table
VLAN MAC Address Type age Secure NTFY Ports
---------+-----------------+--------+---------+------+----+------------------
* 1 e865.49ee.8101 dynamic 0 F F Eth1/10
G - b4de.313e.c5fc static - F F sup-eth1(R)
G 1 b4de.313e.c5fc static - F F sup-eth1(R)
Conditions
We configure the same both "mac-learn disable" under global mode and "switchport mac-learn disable" under interface level" , interface is not learning MAC, everything is fine .
BUT once we configure "no mac-learn disable" and "mac-learn disable" under global mode again, shut/no shut the interface, it triggers the interface starting to learn mac address. The interface flapping can trigger the issue where the interface will start learning the MAC, which is unexpected.
Another trigger is , after we configure "no mac-learn disable" and "mac-learn disable" under global mode again, we then change the traffic from untagged to tagged (or from tagged to untagged) , it also triggers the interface starting to learn mac address.
Workaround
Configure the interface seeing MAC learning in single interface Port-channel, for example: "channel-group mode x", where "x" is the port-channel number.