Scripting Bluetooth Hotspot for Mobian
We already have almost everything we need here.
I want to get Bluetooth hotspot working on my Mobian/Pinephone, Bluetooth tethering a laptop or tablet while on the train, hotel, during a power outage, or at coffee is a basic daily driver phone requirement in my opinion.
I am sure the modern kernel has the required modules but I don't know what the interface name for bluetooth network interface for the pinephones bt driver; bnep0 is the interface used on this old N900 script.
I think this is an easy edit to the other network interfaces like USB already in the wiki unless iptables has changed much since the 2010s.

BT PAN tethering is by far the best and easiest way to tether to your phone's internet connection vs WiFi which wastes far more electricity per Mb transmitted for little benefit other than maybe easier sharing a wifi password with friends vs them having to pair with you on BT.  The security is provided by the bluetooth pairing process.

Below is the scripting to get full service, including DHCP, automatic Bluetooth PAN hotspot running on the Nokia N900, how much will work as is?.  

install the iptables package:

apt-get install iptables

create the following 2 files:


ACTION=="add", SUBSYSTEM=="net",  KERNEL=="bnep0", RUN+="/etc/udev/"
ACTION=="remove", SUBSYSTEM=="net",  KERNEL=="bnep0", RUN+="/etc/udev/"


#! /bin/sh
if [ $ACTION = "add" ]; then
    echo 1 > /proc/sys/net/ipv4/ip_forward
    iptables -t nat -A POSTROUTING ! -o lo -j MASQUERADE
    ifconfig bnep0
    ifconfig bnep0 up
    /usr/sbin/dnsmasq -I lo -z -a -F, -x /var/run/
    iptables -t nat -D POSTROUTING ! -o lo -j MASQUERADE
    if [ -f /var/run/ ]; then
        DNSMASQ_PID=`cat /var/run/`
        rm -f /var/run/
        kill $DNSMASQ_PID

then set /etc/udev/ as executible:

chmod +x /etc/udev/

now whenever an authorised remote device makes a bluetooth pan (nap) connection iptables and dnsmasq are setup to allow that device access to the phones network. TODO: when no internet connection is active ask to set it up

The mobian wiki has instructions for USB, and LAN, WIfi hotspot is included but bluetooth PAN entry is not yet explained in the wiki.
I have moved beyond this post to working on the bluez and udev rules
(edit) and now I am trying to fix routing but I have PAN/NAP profile working and can pair and get an IP address just working to fix the bridging between the WAN/internet and BT LAN.

see here

Possibly Related Threads…
Thread Author Replies Views Last Post
  mobian installed to eMMC - how to install tow-boot grump_fiddle_reinstall 6 922 11-22-2023, 11:46 AM
Last Post: aLoop100o
  bookworm vs trixie discussion for mobian in pinephone regular. zetabeta 1 218 11-20-2023, 07:06 AM
Last Post: Zebulon Walton
  phone call using built it app will not go to bluetooth motox6 4 3,114 09-23-2023, 01:10 AM
Last Post: Aakriti
  What actions needed to keep on mobian testing user641 3 1,275 09-05-2023, 06:44 AM
Last Post: Zebulon Walton
  Mobian boot failed with zstd message after upgrade. Mahgue 0 397 09-01-2023, 11:29 AM
Last Post: Mahgue
  how to update mobian over tor vusra 13 5,713 07-09-2023, 08:57 PM
Last Post: vusra
  opensnitch outbound firewall now works on mobian vusra 2 1,571 07-09-2023, 01:37 AM
Last Post: vusra
  Using Nativefier on PP64 with Mobian paulcarton 0 449 07-05-2023, 03:57 AM
Last Post: paulcarton
  Has anyone got briar-desktop running on mobian? vusra 5 2,493 06-19-2023, 03:02 PM
Last Post: vusra
  How to enable ipv6 for hotspot robgadget 1 608 04-28-2023, 06:59 AM
Last Post: wibble

Forum Jump:

Users browsing this thread: 1 Guest(s)