khvzak / bluez-tools

A set of tools to manage bluetooth devices for linux
GNU General Public License v2.0
179 stars 51 forks source link

bt-network do not distribute ip addresses #36

Open geremi1 opened 4 years ago

geremi1 commented 4 years ago

Hi, when I try to connect bt-network to the Internet interface like this :

 sudo bt-network -c wlo1 pan0

It does not work at all. it prints this :

**
ERROR:lib/bluez/device.c:165:device_get_dbus_object_path: assertion failed: (DEVICE_IS(self))
Bail out! ERROR:lib/bluez/device.c:165:device_get_dbus_object_path: assertion failed: (DEVICE_IS(self))
Aborted (core dumped)

So how can I create a nap server on the bridge pan0 for it to have Internet connection, so that when I connect a device, it appears as bnep0, and have Internet ???

https://superuser.com/questions/1525732/how-to-link-network-device-with-pan0

zggzcgy commented 4 years ago
bt-network -c <your device name or your device mac> uuid

Example:

bt-network -c Huawei 00001116-0000-1000-8000-00805f9b34fb
bt-network -c 00:11:22:33:44:55 00001116-0000-1000-8000-00805f9b34fb

devices name and uuid can be viewed in this bluetoolctl tools

$ bluetoolctl
[bluetooth]# paired-devices 
Device 00:11:22:33:44:55 Huawei
[bluetooth]# info 00:11:22:33:44:55
Device 00:11:22:33:44:55 (public)
        Name: Huawei    <--name
        Alias: Huawei
        Class: 0x005a020c
        Icon: phone
        Paired: yes
        Trusted: no
        Blocked: no
        Connected: no
        LegacyPairing: no
        UUID: Unknown                   (0000046a-0000-1000-8000-00805f9b34fb)
        UUID: OBEX Object Push          (00001105-0000-1000-8000-00805f9b34fb)
        UUID: Headset                   (00001108-0000-1000-8000-00805f9b34fb)
        UUID: Audio Source              (0000110a-0000-1000-8000-00805f9b34fb)
        UUID: A/V Remote Control Target (0000110c-0000-1000-8000-00805f9b34fb)
        UUID: Advanced Audio Distribu.. (0000110d-0000-1000-8000-00805f9b34fb)
        UUID: Headset AG                (00001112-0000-1000-8000-00805f9b34fb)
        UUID: PANU                      (00001115-0000-1000-8000-00805f9b34fb)<--UUID key:PANU
        UUID: NAP                       (00001116-0000-1000-8000-00805f9b34fb)<--UUID key:NAP 
        UUID: Handsfree Audio Gateway   (0000111f-0000-1000-8000-00805f9b34fb)
        Modalias: bluetooth:v010Fp107Ed1436
[bluetooth]#

Automatic address assignment Make sure your server has started dhcp service Example:

# dnsmasq -I br0 -F 192.168.1.100,192.168.1.200,255.255.255.0

Make sure your client has dhcp enabled

# dhclient -v bnep0
Internet Systems Consortium DHCP Client 4.4.2
Copyright 2004-2020 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/bnep0/11:22:33:44:55:66
Sending on   LPF/bnep0/11:22:33:44:55:66
Sending on   Socket/fallback
DHCPDISCOVER on bnep0 to 255.255.255.255 port 67 interval 5
DHCPOFFER of 192.168.1.139 from 192.168.1.1
DHCPREQUEST for 192.168.1.139 on bnep0 to 255.255.255.255 port 67
DHCPACK of 192.168.1.139 from 192.168.1.1
bound to 192.168.1.139 -- renewal in 1652 seconds.