Skip to content

Instantly share code, notes, and snippets.

@cengiz-io
Forked from rcarmo/bt-agent.service
Last active June 1, 2025 19:23
Show Gist options
  • Save cengiz-io/075b80b60a690fefb7efe716cf9dbcd2 to your computer and use it in GitHub Desktop.
Save cengiz-io/075b80b60a690fefb7efe716cf9dbcd2 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=Bluetooth PAN
After=network.target bluetooth.service
Requires=bluetooth.service
[Service]
ExecStart=/usr/bin/bt-network -s nap pan0
ExecStartPost=/usr/bin/bt-adapter --set Discoverable 1
Type=simple
Restart=always
[Install]
WantedBy=multi-user.target
# in /etc/systemd/network
[NetDev]
Name=pan0
Kind=bridge
# in /etc/systemd/network
[Match]
Name=pan0
[Network]
Address=172.20.1.1/24
DHCPServer=yes
apt-get install bluez-tools
# place other files
systemctl enable --now systemd-networkd
systemctl enable --now bt-agent
systemctl enable --now bt-network
bt-adapter --set Discoverable 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment