MikroTik Tutorial: show mac address table

MikroTik Tutorial: show mac address table

Here are the commands to show the mac address table on a MikroTik Router. In addition to using the command line to show the mac address table, this tutorial I will also show you how to search for a specific MAC address and filter the table to show mac addresses learned through a specific port. There are actually several commands that you should know, depending on how your router is configured.

The two types of configuration are software switching (using bridge interfaces) and hardware switching. You can actually have a valid configuration that uses both. And in this scenario, separate mac address tables are maintained.

CLI command to show mac table

interface bridge host print
  Flags: X - disabled, I - invalid, D - dynamic, L - local, E - external 
   #       MAC-ADDRESS        VID ON-INTERFACE      BRIDGE     AGE                 
   0   DL  D4:CA:XX:XX:XX:F6      bridge            bridge
   1   DL  EE:8A:XX:XX:XX:2A      loopback0         loopback0 
   2   D   00:08:XX:XX:XX:A0      ether10           MGMT_br... 3m31s               
   3   D   00:0C:XX:XX:XX:E3      ether10           MGMT_br... 0s                  
...
  12   D   80:2A:XX:XX:XX:6E      ether10           MGMT_br... 21s                 
  13   D   80:2A:XX:XX:XX:03      ether10           MGMT_br... 12s                 
  14   D   B4:FB:XX:XX:XX:85      ether10           MGMT_br... 35s                 
  15   D   B4:FB:XX:XX:XX:51      ether10           MGMT_br... 35s                 
  16   DL  D4:CA:XX:XX:XX:F7      MGMT_bridge       MGMT_br...
  17   D   F0:9F:XX:XX:XX:59      ether10           MGMT_br... 34s                 
  18   D   F0:9F:XX:XX:XX:10      ether10           MGMT_br... 8s                  

This command will print the contents of the mac address table for all bridges. If you have multiple bridge interfaces and want to narrow down the list to a specific bridge, here is the command.

List mac address table for a specific bridge interface

interface bridge host print where bridge=bridge1

where bridge1 is the name of your bridge interface.

Find mac addresses learned through a specific port

interface bridge host print where on-interface=ether10

This will find all mac addresses learned through ether10 across all mac address tables. If you want to target a specific bridge you will use the following command.

Find mac addresses learned through a specific port on a specific bridge

interface bridge host print where on-interface=ether10 bridge=bridge1

Filter out local mac addresses

The results so far will also include the local mac addresses of the bridge interface annotated with the L flag. If you want exclude these local mac addresses from the list just append local=no.

interface bridge host print where local=no

Search for a specific MAC address in the table

interface bridge host print where mac-address=44:D9:E7:36:E1:67

Search for all mac addresses with a specific OUI prefix

interface bridge host print where mac-address~44:D9:E7

show mac address table for hardware switching

interface ethernet switch host print
Flags: D - dynamic, I - invalid 
   #   SWITCH                              MAC-ADDRESS       PORTS                              TIMEOUT DROP MIRROR VLAN-ID
   0 D switch1                             00:A0:XX:XX:XX:D7 switch1-cpu                        3m30s   no   no           1
   1 D switch1                             6C:C2:XX:XX:XX:EA switch1-cpu                        3m30s   no   no           1
   2 D switch1                             84:2B:XX:XX:XX:50 switch1-cpu                        3m30s   no   no           1
   3 D switch1                             D4:CA:XX:XX:XX:59 switch1-cpu                        3m      no   no           1
   4 D switch1                             2C:C5:XX:XX:XX:94 switch1-cpu                        3m      no   no           1
...
  15 D switch1                             70:56:XX:XX:XX:B1 switch1-cpu                        3m30s   no   no           1
  16 D switch1                             E4:8D:XX:XX:XX:67 ether2                             3m30s   no   no           1
  17 D switch1                             C0:EA:XX:XX:XX:BC ether1                             3m30s   no   no           1

Find mac addresses learned from an interface

List all mac addresses learned from ether1

/interface ethernet switch host print where ports=ether1

Search switch mac table for a specific mac address

 /interface ethernet switch host print where mac-address=DC:A4:CA:A3:18:21

I hope you have enjoyed this tutorial about how to query the mac address table from the RouterOS command line. Did I miss something? Leave a comment below and checkout my other MikroTik Tutorials.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.