Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to filter MAC addresses using tcpdump?

I am running tcpdump on DD-WRT routers in order to capture uplink data from mobile phones. I would like to listen only to some mac addresses. To do this I tried to run the command using a syntax similar to Wireshark:

tcpdump -i prism0 ether src[0:3] 5c:95:ae -s0 -w | nc 192.168.1.147 31337

so that I can listen to all the devices that have as initial mac address 5c:95:ae.

The problem is that the syntax is wrong and I was wondering if anyone of you knows the right syntax to get what I want.

like image 613
Giovanni Soldi Avatar asked Oct 26 '12 12:10

Giovanni Soldi


People also ask

How do I filter IP tcpdump?

To filter on TCP and UDP ports, use the port directive. This captures both TCP and UDP traffic using the specified port either as a source or destination port. It can be combined with tcp or udp to specify the protocol, and src or dst to specify a source or destination port.

Does tcpdump capture ARP?

tcpdump Filter Packets – Capture all the packets other than arp and rarp.


1 Answers

With man pcap-filter I found this solution:

tcpdump "ether[6:2] == 0x5c95 and ether[8:1] == 0xae"
like image 77
graphite Avatar answered Oct 11 '22 20:10

graphite