It seems to be possible to run USB over IP, e.g. using usbip which is part of some Linux distros e.g. https://www.archlinux.org/packages/?q=usbip

Is there something similar for Bluetooth over IP? (NOT: IP over Bluetooth).

This would allow the physical separation of, say, a BT-enabled smartphone from a BT-enabled headset by means of the internet.

Linux bnep might be able to do that, but I haven't been able to find instructions for how to.


Solution 1:

Although in our technological world everything today seems possible, as far as I know true Bluetooth-to-Bluetooth-over-IP has never been implemented. I will try and explain the difficulties, that although not insurmountable, are the cause for this situation.

Bluetooth itself is is a wireless technology standard for exchanging data over short distances. It is usually used for device-to-device connections and involves the notion of Pairing, for security purposes. The Bluetooth protocol is extremely versatile and can be used for a many purposes. Its popularity arises from the fact that it operates at frequencies that are globally unlicensed (but not unregulated).

True Bluetooth-to-Bluetooth-over-IP would require two Bluetooth devices to pair over IP. This is not the same as, for example, two persons using Skype to talk over the Internet via Bluetooth headsets, because the headsets are paired with their computers and not with one another.

Here are some excerpts from the Wikipedia article OSI model :

Layer 1: Physical Layer

The physical layer of Parallel SCSI operates in this layer, as do the physical layers of Ethernet and other local-area networks, such as Token Ring, FDDI, ITU-T G.hn, and IEEE 802.11 (Wi-Fi), as well as personal area networks such as Bluetooth and IEEE 802.15.4.

Layer 4: Transport Layer

An example of a transport-layer protocol in the standard Internet stack is Transmission Control Protocol (TCP), usually built on top of the Internet Protocol (IP).

TCP and UDP are transport level 4 protocols, whereas Bluetooth is a lower physical level 1 protocol. Thus you could use TCP or UDP on top of Bluetooth, just as you use TCP and UDP on top of Ethernet, but the opposite is much harder.

The Bluetooth protocol stack includes its own transport protocols: L2CAP and RFCOMM, where RFCOMM links use the L2CAP layer. You can work some IP tunneling over Bluetooth encapsulating UDP packets over RFCOMM links.

Using pure OSI terminology, it is impossible, is even a contradiction of terms, to use a layer 1 protocol over layer 4.

Practically speaking, we could imagine a software-written virtual adapter that would declare itself to Linux on the client side as a physical Bluetooth device and talk over IP to another such virtual Bluetooth device on the server-side Linux. But the complexity involved in emulating OSI layers, and the programming effort that is required for implementing the very versatile Bluetooth protocol and its master-slave architecture, make creating such a general implementation a very demanding exercise that is unlikely to happen, as there is currently no demand for such software.

Solution 2:

I haven't tried any of this in practice but it's stuff I could find that talks about "Bluetooth over IP".

The book Linux Kernel Networking is very technical but it describes how to do "Bluetooth over IP":

On the server side:

pand --listen --role=NAP

On the client side:

pand --connect btAddressOfTheServer

This creates a virtual interface bnep0.

Apparently this just gives you L2CAP, which can only send packets over a "piconet". But for L2CAP there are thoughts about how to send them over IP in an IETF draft: Transmission of IP Packets over Bluetooth Networks.

The IETF may consider to run L2CAP over IP over the Host Controller with a new protocol:

                       +------------+
                       |    L2CAP   |
                       +------------+
                       |     IP     |
                       +------------+
                       | Foo2 Proto.|
                       +------------+
                       | Host Cont. |
                       +------------+

Figure 4.3.3 - 3rd. Possible Bluetooth Protocol Stack for IP networking

And then I also found UbiPAN: A Bluetooth Extended Personal Area Network which mentions "Bluetooth over IP" - but unfortunately it doesn't look like UbiPAN has been released as free software.