Skip to content

Instantly share code, notes, and snippets.

@velitasali
Last active June 23, 2024 07:41
Show Gist options
  • Save velitasali/e9a844b0a72af6f1ff1a7a93b9827a23 to your computer and use it in GitHub Desktop.
Save velitasali/e9a844b0a72af6f1ff1a7a93b9827a23 to your computer and use it in GitHub Desktop.
Bluetooth NAP Network on RPi4 - package: bluez-utils
# /etc/systemd/system/bt-agent.service
[Unit]
Description=Bluetooth Auth Agent
[Service]
ExecStart=/usr/bin/bt-agent -c NoInputNoOutput
Type=simple
[Install]
WantedBy=multi-user.target
# /etc/systemd/system/bt-network.service
[Unit]
Description=Bluetooth NEP PAN
After=pan0.network
[Service]
ExecStart=/usr/bin/bt-network -s nap pan0
Type=idle
[Install]
WantedBy=multi-user.target
# /etc/systemd/network/pan0.netdev
[NetDev]
Name=pan0
Kind=bridge
# /etc/systemd/network/pan0.network
[Match]
Name=pan0
[Network]
Address=192.168.2.1/24
DHCPServer=yes
@mocallins
Copy link

I love this setup, and i made a small minor tweak to bt-agent.service, that gives you the command to use on the client, lol.
if you happen to work from a terminal client that allows copy and paste, otherwise you would just type it out as listed.

ExecStartPost=sh -c 'printf "%%s\n" "clients use: sudo bt-network -C $( bt-adapter -l | sed -rn "s/.?(([[:xdigit:]]{2}:){5}[[:xdigit:]]{2})./\1/p" ) nap"'

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