Skip to content

Instantly share code, notes, and snippets.

@tdegrunt
Forked from rcarmo/bt-agent.service
Created June 28, 2019 05:56
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tdegrunt/33a93d6ab3a321a168653c9ac96948e0 to your computer and use it in GitHub Desktop.
Save tdegrunt/33a93d6ab3a321a168653c9ac96948e0 to your computer and use it in GitHub Desktop.
Set up PAN networking on Raspbian Stretch (use sudo to create these files and run all commands)
# in /etc/systemd/system
[Unit]
Description=Bluetooth Agent
[Service]
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
Type=simple
[Install]
WantedBy=multi-user.target
# in /etc/systemd/system
[Unit]
Description=Bluetoot PAN
After=pan0.network
[Service]
ExecStart=/usr/bin/bt-network -s nap pan0
Type=simple
[Install]
WantedBy=multi-user.target
# in /etc/systemd/network
[NetDev]
Name=pan0
Kind=bridge
# in /etc/systemd/network
[Match]
Name=pan0
apt-get install bluez-tools
# place other files
systemctl enable systemd-networkd
systemctl start systemd-networkd
systemctl enable bt-agent
systemctl start bt-agent
systemctl enable bt-network
systemctl start bt-network
bt-adapter --set Discoverable 1
@JacekKac
Copy link

JacekKac commented Nov 8, 2020

Hi, i tried this to use Iphones hotspot from raspberry pi, and can not get ip address for bnep0 interfaces. Everythink looks fine but there is not internet connectionn at all:

bnep0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 169.254.107.173 netmask 255.255.0.0 broadcast 169.254.255.255
inet6 fe80::ac48:63eb:a7f1:2fce prefixlen 64 scopeid 0x20
inet6 fe80::dea6:32ff:fe53:48e3 prefixlen 64 scopeid 0x20
ether dc:a6:32:53:48:e3 txqueuelen 1000 (Ethernet)
RX packets 40 bytes 6512 (6.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 58 bytes 9687 (9.4 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

Nov 8 09:55:16 raspberrypi bluetoothd[550]: bnep: bridge pan0: interface bnep0 added
Nov 8 09:55:16 raspberrypi systemd-networkd[312]: bnep0: Gained carrier
Nov 8 09:55:16 raspberrypi systemd-networkd[312]: pan0: Gained carrier
Nov 8 09:55:16 raspberrypi kernel: [44554.530943] pan0: port 1(bnep0) entered blocking state
Nov 8 09:55:16 raspberrypi kernel: [44554.530960] pan0: port 1(bnep0) entered disabled state
Nov 8 09:55:16 raspberrypi kernel: [44554.531384] device bnep0 entered promiscuous mode
Nov 8 09:55:16 raspberrypi kernel: [44554.532349] pan0: port 1(bnep0) entered blocking state
Nov 8 09:55:16 raspberrypi kernel: [44554.532365] pan0: port 1(bnep0) entered forwarding state
Nov 8 09:55:16 raspberrypi systemd-udevd[11985]: Using default interface naming scheme 'v240'.
Nov 8 09:55:16 raspberrypi dhcpcd[618]: bnep0: IAID 32:53:48:e3
Nov 8 09:55:16 raspberrypi dhcpcd[618]: bnep0: adding address fe80::ac48:63eb:a7f1:2fce
Nov 8 09:55:16 raspberrypi avahi-daemon[335]: Joining mDNS multicast group on interface bnep0.IPv6 with address fe80::ac48:63eb:a7f1:2fce.
Nov 8 09:55:16 raspberrypi avahi-daemon[335]: New relevant interface bnep0.IPv6 for mDNS.
Nov 8 09:55:16 raspberrypi avahi-daemon[335]: Registering new address record for fe80::ac48:63eb:a7f1:2fce on bnep0..
Nov 8 09:55:17 raspberrypi dhcpcd[618]: bnep0: soliciting an IPv6 router
Nov 8 09:55:17 raspberrypi dhcpcd[618]: bnep0: soliciting a DHCP lease
Nov 8 09:55:18 raspberrypi systemd-networkd[312]: bnep0: Gained IPv6LL
Nov 8 09:55:18 raspberrypi avahi-daemon[335]: Registering new address record for fe80::dea6:32ff:fe53:48e3 on bnep0.
.
Nov 8 09:55:22 raspberrypi dhcpcd[618]: bnep0: probing for an IPv4LL address
Nov 8 09:55:27 raspberrypi dhcpcd[618]: bnep0: using IPv4LL address 169.254.107.173
Nov 8 09:55:27 raspberrypi avahi-daemon[335]: Joining mDNS multicast group on interface bnep0.IPv4 with address 169.254.107.173.
Nov 8 09:55:27 raspberrypi avahi-daemon[335]: New relevant interface bnep0.IPv4 for mDNS.
Nov 8 09:55:27 raspberrypi avahi-daemon[335]: Registering new address record for 169.254.107.173 on bnep0.IPv4.
Nov 8 09:55:27 raspberrypi dhcpcd[618]: bnep0: adding route to 169.254.0.0/16
Nov 8 09:55:30 raspberrypi dhcpcd[618]: bnep0: no IPv6 Routers available

how to obtain the ip address from Iphones dhcp to get internet connection ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment