TCPDump – How to Filter by MAC Address

ipmac addresstcpdump

I would like to display all traffic for or from a specific MAC address.
For that I tried

sudo tcpdump host aa:bb:cc:11:22:33

It does not work and returns me an error

tcpdump: pktap_filter_packet: pcap_add_if_info(en0, 1) failed: pcap_add_if_info: pcap_compile_nopcap() failed

I don't know how to interpret this error message and I don't know how to solve the problem.

Any help ?

Best Answer

You have used the following as your packet filter: host aa:bb:cc:11:22:33

As it stands, this is looking for an IP or hostname but you are giving it a MAC address.

To use a MAC address, you need to include the ether packet filter primitive.

In your case, the following should work:

sudo tcpdump ether host aa:bb:cc:11:22:33

Or, if it needs you to specify the interface, then it would be something like:

sudo tcpdump -i eth0 ether host aa:bb:cc:11:22:33