How do I find my MAC address table in FortiGate?

Description
This article describes how to check MAC-address table in Transparent mode.

Solution

In transparent mode, to forward L2 traffic, the FortiGate does actually rely on its L2 forwarding database, which can be dumped with the command '# diag netlink brctl name host root.b' (for the root VDOM), while the ARP table would only be used for it's own IP communications.

The ARP/GARP that are sent by the external units will be used to populate the L2 FDB and change appropriately the destination MAC addresses for existing sessions in case of MAC changes.

Those commands  will dump the L2 forwarding table for each VDOM bridge instance.
From there, the devices MAC addresses that are located on each VLAN/VDOM will be available.

# Config global
# diag netlink brctl name host .b

Example for the root VDOM.

#diag netlink brctl name host root.b
#diag netlink brctl list

Hey guys,

Setup is a Fortigate 60E and a Fortiswitch 108E. To save some free ports on the switch I'm using a hardware switch in the Fortigate for my public VLAN. The hardware switch consists of port 6 and 7 where one of the ports are connected to my ISP and the other to a WAN-interface of a server, in addition the hardware switch has an SVI to assign the Fortigate a public IP.

What I'd like to do is find out what port the ISP is connected in of the two, if I do get system arp I get:

fw01 # get sys arp

Address Age(min) Hardware Addr Interface

0 08:96:ad:06:cd:24 internet;svi-sw

But there seems to be no way of knowing which of the two ports in the hardware switch the MAC-adress 08:96:ad:06:cd:24 belongs to? In addition, AFAIK, there is no way so set a description on individual ports in a hardware switch? Anyone know a solution for this?

Running 6.0.4, thanks!

Posted by on May 19, 2021

Tracking down MACs from a switch can be very beneficial. You can use the information from the MAC table to track down where a device is plugged into, or if there is some kind of loop in the network.

This command is used from the Fortigate to drill down to the Fortiswitch. I do believe it would also work directly from the Fortiswitch.

To display the whole MAC table:

diagnose switch-controller switch-info mac-table

Lets say I need to look for the last 4 of the MAC to find exactly where this device plugs into.

diagnose switch-controller switch-info mac-table | grep 3a:fe

00:60:6e:ec:3a:fe port1 1

Now we can see that device is plugged into port 1 of the switch.

I have a Fortinet FG-60E firewall running FortiOS v6.0.1. A wireless access point is connected to one of the ports (internal3). There are currently no other clients connected to the wireless access point.

How do I find my MAC address table in FortiGate?

Is there a FortiOS command (or commands) that will tell the MAC address of the wireless access point?

update 1

get system arp almost does what I want, except it doesn't specify the port number of the internal interface. You can see from this snippet of output:

FGT60E4Q16045123 # get system arp
Address           Age(min)   Hardware Addr      Interface
10.0.1.87         0          00:0c:29:60:8c:f4 internal
10.0.1.20         125        5c:aa:fd:1b:b5:5a internal
10.0.1.73         0          00:0c:29:a4:29:9e internal
10.0.1.96         1          00:0c:29:76:7c:2b internal
10.0.1.13         0          5c:70:a3:7d:28:82 internal
10.0.1.6          0          00:11:32:0f:ab:f9 internal
10.0.1.89         0          00:0c:29:c8:98:c4 internal
10.0.1.22         104        b8:e9:37:5f:ac:2c internal
10.0.1.75         0          00:0c:29:05:ab:42 internal
10.0.1.98         0          00:0c:29:05:53:49 internal

The interface is listed as "internal" and not "internal1", "internal2", etc.. The "internal" interface has 7 ports:

How do I find my MAC address table in FortiGate?

update 2

The output from diag switch-controller dump mac-hosts-switch-port does not include the port number. Here's an example:

vd root/0  f0:9f:c2:30:d5:76  gen 159  req TOUS/2e
  created 69257s  gen 20  seen 45873s  internal  gen 79
  ip 192.168.1.1  src arp
  host 'OpenWrt'  src dhcp
vd root/0  00:0c:29:76:7c:2b  gen 1853  req TOU/2c
  created 2190525s  gen 47  seen 318s  internal  gen 1447
  ip 10.0.1.96  src arp
  host 'cdh06'  src dhcp
  server http

The first entry is the device I'm trying to identify via Fortinet CLI. As far as I can tell, there's no way to associate the MAC with a particular port on the firewall.

How do I find the ARP table in FortiGate?

Technical Tip: How to display the ARP table on a FortiGate unit, configured in NAT mode.
Scope: FortiOS firmware versions 4.0 MR3 or 5.0.x..
When VDOMs are not enabled:.
When VDOMs are enabled:.
FGT # config vdom. FGT (vdom) # edit root. current vf=root:0..
FGT (root) # get system arp..

How do I change the MAC address on a Fortinet firewall?

How to set or change the MAC addresses associated with a FortiGate interface.
Set the MAC Address on the Interface..
Execute the commands: # config sys int. # edit # set macaddr # end..
Restart the routing engine on the FortiGate. FGT# exec router restart..

How do I allow MAC address in FortiGate firewall?

0 | Fortinet Documentation Library..
For Category, select Address..
For Type, select MAC Address Range and enter the address range..
Enter the other fields and click OK..

How can I see what devices are connected to FortiGate?

In the FortiGate GUI, User & Device > Device List displays a list of devices attached to the FortiSwitch ports. For each device, the table displays the IP address of the device and the interface (FortiSwitch name and port).