Support Forum
The Forums are a place to find answers on a range of Fortinet products from peers and product experts.
Jeremy5385
New Contributor III

Easily Identify FortiSwitch port searching by MAC (FortiLink CLI)

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.

1 REPLY 1
AEK
SuperUser
SuperUser

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.

AEK
AEK
Announcements
Check out our Community Chatter Blog! Click here to get involved
Labels
Top Kudoed Authors