

Next, in the screen shot above you can see the OBEX connection going up, macOS confirming it, and then Linux doing a "Put continue" for the "Bluetooth.txt" file. The Service Search Attribute Response packet from macOS is now populated with all of the information needed to start the file transfer over OBEX. The first thing I took a look at was the original connection setup packets seen in my failing case. I was also able to see this file being transferred in the packet trace. To check which version of BlueZ, Libpcap, and TCPdump you have installed, run the following commands:Īfter enabling Bluetooth file sharing on macOS I ran the same packet capture again and was able to successfully transfer the file from Linux to macOS. Next you will need a version of Libpcap 0.9.6 and later install on your Linux distro to run TCPDump. Setting up Linux for a Bluetooth Packet Capture 👨💻Ĭapturing Bluetooth on Linux can only be done if your kernel is 2.4.6 or later and includes the BlueZ stack within it. The connection and file transfer is all captured via TCPDump for analysis in Wireshark. This example sets up a Bluetooth connection between two machines and transfers a file from one to the other.

NOTE: This tutorial was created using a Ubuntu 16.04 as the host machine, running Bluetooth 5.37 and a macOS 10.14 as the controller machine, running Bluetooth 6.0. And that is why I wanted to write this tutorial, to provide insight on how to use TCPDump to capture Bluetooth packets on Linux and to provide more insight while debugging stubborn Bluetooth connection issues. Linux however, does provide the best flexibility by allowing the user to run a packet capture right off any Bluetooth interface. Windows does not provide any straight forward Bluetooth packet capturing mechanism that I am aware of. So, what do you do when connections are being stubborn? Do you try and reconnect and just hope for the best, or is there a better way to see what is going on with these stubborn connections? The answer to this probably depends on what operating system you are running. On macOS there is a tool called PacketLogger that allows you to identify the general flow of Bluetooth packets in and out of the machine. Generally it seems harder to connect two devices that are not from the same manufacturer. In my experience working with Bluetooth, I have seen connections go up fairly easily or be very stubborn and not want to connect at all.

Bluetooth connections allow for smartphones, computers, cars, and even IoT devices to communicate all over a frequency that operates at ~ 2480 MHz. Opening a Bluetooth connection between two devices is a fast and energy efficient way to communicate data over a short distance.
