I’m using Fortilink to manage switches from the Fortigate. When searching to find the port for a device MAC I can dump the mac table using this command:
# diag switch-controller switch-info mac-table
This gives me pages and pages since I have 25 FortiSwitches on this system. When I use grep and add the MAC, there can be one line for every switch that has this entry in its table. I can tell from the output below that the device is on Port43 but no good way to tell which FortiSwitch in Foritlink.
# diag switch-controller switch-info mac-table | grep 23:27
MAC: fc:0f:e7:17:23:27 VLAN: 249 Trunk: _FlInK1_ICL0_(trunk-id 0)
MAC: fc:0f:e7:17:23:27 VLAN: 249 Trunk: 8EPTF24001548-0(trunk-id 11)
MAC: fc:0f:e7:17:23:27 VLAN: 249 Trunk: E24TF24002765-0(trunk-id 1)
MAC: fc:0f:e7:17:23:27 VLAN: 249 Trunk: E24TF24002765-0(trunk-id 1)
MAC: fc:0f:e7:17:23:27 VLAN: 249 Trunk: _FlInK1_MLAG0_(trunk-id 0)
MAC: fc:0f:e7:17:23:27 VLAN: 249 Port: port43(port-id 43)
MAC: fc:0f:e7:17:23:27 VLAN: 249 Trunk: 8EPTF24001548-0(trunk-id 0)
It would be nice if every line in the dump had the FortiSwitch name at the beginning, but it doesn’t. Anyone found a good way to get this information in the CLI? I’ve tried using the -f switch with grep but that doesn’t work.
Since FOS' grep command is not as rich as Linux', as a workaround I'd copy the whole text to my text editor and search for the MAC.
A dumb workaround but is better than nothing.
| User | Count |
|---|---|
| 2823 | |
| 1431 | |
| 812 | |
| 787 | |
| 455 |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.