Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Sailfish (Jolla), Bluetooth PAN or DUN, and OS X

    Reply
    jsiren | # 1 | 2013-12-17, 01:10 | Report

    Call me a glutton for punishment, but I thought I'd try this out.

    I looked around the Jolla operating system and figured out that it should be possible to share the network connection through Bluetooth, specifically my laptop running OS X Mavericks.

    Now, my first step was to simply start pand --listen --role NAP --master and see if the laptop would connect its Bluetooth PAN profile. I had to delete and reassociate the Jolla, only then was it shown as a PAN device (Mavericks no longer has a button to rescan the Bluetooth profile, although there may be a utility for the purpose in XCode).

    Then I assigned a fixed IP address (private, off the top of my head, not in use anywhere in the nearby networks) to the Bt PAN interface on the laptop, after which its status changed to "Connected". What this means is something of a mystery, however, as there was no outward route from the laptop, and there was no obvious interface at either end to create it to.

    (Of course I could just route 3G to WiFi with iptables, provided this thing knows how to make an ad-hoc network, but where's the fun in that? )

    Helpful advice is welcome. If the Jolla 1/2014 update introduces a WiFi or Bluetooth sharing function, I'll be very happy indeed

    The next step would be to find out how to get the two devices talking to each other over Bt, the rest is trivial

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to jsiren For This Useful Post:
    mattaustin

     
    jsiren | # 2 | 2013-12-17, 22:23 | Report

    Hmm. Seems that bridge-utilities would be needed, but isn't in repositories. Same goes for a dhcp server. l2ping from the phone does wake up my MBP, so something is happening.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    hlub | # 3 | 2013-12-18, 22:34 | Report

    I was able to set up a PAN between my laptop and my Jolla phone only after uncommenting
    DisablePlugins = network
    in /etc/bluetooth/main.conf on the telephone, and then starting pand with the appropriate options on both sides (phone and laptop)

    I can now ssh into the phone over the bluetooth link.

    Of course bridging and dhcp would be the icing on the cake, but now that I have a connection I should be able to proceed in much the same way as with an USB link and use the phone as a gateway to the internet.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by hlub; 2013-12-18 at 22:36.
    The Following 3 Users Say Thank You to hlub For This Useful Post:
    jsiren, mattaustin, Stuarty

     
    jsiren | # 4 | 2013-12-19, 22:07 | Report

    Originally Posted by hlub View Post
    I was able to set up a PAN between my laptop and my Jolla phone only after uncommenting
    DisablePlugins = network
    in /etc/bluetooth/main.conf on the telephone, and then starting pand with the appropriate options on both sides (phone and laptop)

    I can now ssh into the phone over the bluetooth link.
    Ah, that was it. Thank you very much. I didn't realize it had to be disabled.

    Edit: So for future reference, here's what I did:
    in /etc/bluetoot/master.conf add line
    DisablePlugins = network

    After rebooting I ran these commands (as root)
    echo 1 > /proc/sys/net/ipv4/ip_forward
    pand --listen --role NAP --master
    /sbin/iptables -t nat -A POSTROUTING -o rmnet0 -j MASQUERADE
    /sbin/iptables -A FORWARD -i bnep0 -o rmnet0 -j ACCEPT
    /sbin/iptables -A FORWARD -i rmnet0 -o bnep0 -m state --state RELATED,ESTABLISHED -j ACCEPT
    (add iptables rules as you see fit, these are the bare minimum to communicate from BtPAN to mobile data)

    Once the connection was successful, since there was no DHCP server that I knew of, I just configured the interface manually:
    ifconfig bnep0 address broadcast broadcast netmask netmask
    ifconfig bnep0 up

    At the Mac end I gave a static address, and voilą - I was tethered.

    Of course these commands should be scripted and wrapped into a nice UI, and DHCP might be nice to reduce the need of configuration at the other end, but there's no technical obstacle to any of this.

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by jsiren; 2013-12-19 at 22:21.

     
    hlub | # 5 | 2013-12-19, 23:43 | Report

    Although the phone runs its own nameserver (connmand, probably) I could not get it to answer queries from my laptop.

    8.8.8.8 is a reasonable (or even superior?) alternative.

    I did not expect this to be solved so easily and quickly. Underneath its shiny user interface, the Jolla is a completely standard linux system, so with a little Googling, most of the 'sysadmin-like' problems (like this one) should be easily solvable.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    jsiren | # 6 | 2013-12-20, 00:24 | Report

    Originally Posted by jsiren View Post
    Ah, that was it. Thank you very much. I didn't realize it had to be disabled.

    Edit: So for future reference, here's what I did:
    in /etc/bluetoot/master.conf add line
    DisablePlugins = network

    After rebooting I ran these commands (as root)
    echo 1 > /proc/sys/net/ipv4/ip_forward
    pand --listen --role NAP --master
    /sbin/iptables -t nat -A POSTROUTING -o rmnet0 -j MASQUERADE
    /sbin/iptables -A FORWARD -i bnep0 -o rmnet0 -j ACCEPT
    /sbin/iptables -A FORWARD -i rmnet0 -o bnep0 -m state --state RELATED,ESTABLISHED -j ACCEPT
    (add iptables rules as you see fit, these are the bare minimum to communicate from BtPAN to mobile data)

    Once the connection was successful, since there was no DHCP server that I knew of, I just configured the interface manually:
    ifconfig bnep0 address broadcast broadcast netmask netmask
    ifconfig bnep0 up

    At the Mac end I gave a static address, and voilą - I was tethered.

    Of course these commands should be scripted and wrapped into a nice UI, and DHCP might be nice to reduce the need of configuration at the other end, but there's no technical obstacle to any of this.
    In fact, forget all the above. After a bit of research, I found the simplest solution.
    1. pkcon install connman-test (you only need to do this once)
    2. cd /usr/lib/connman/test; ./enable-tethering bluetooth
    3. ???
    4. profit!

    Conversely, if you want to stop tethering, just run
    cd /usr/lib/connman/test; ./disable-tethering bluetooth

    This does all that is needed for tethering. All that Jolla needs to do is put a nice friendly button on the UI

    Edit | Forward | Quote | Quick Reply | Thanks

    Last edited by jsiren; 2013-12-20 at 00:27.
    The Following User Says Thank You to jsiren For This Useful Post:
    hlub

     
    jsiren | # 7 | 2013-12-20, 00:34 | Report

    Originally Posted by hlub View Post
    I did not expect this to be solved so easily and quickly. Underneath its shiny user interface, the Jolla is a completely standard linux system, so with a little Googling, most of the 'sysadmin-like' problems (like this one) should be easily solvable.
    Yes, that's the nice bit about it. I've "grown up" around *nix systems since 1995 and done various sysadmin jobs for a living since 1997 (which is also how I fund my current studies in a completely different field), so I quite like the idea of carrying a Linux box in my pocket

    Edit | Forward | Quote | Quick Reply | Thanks

     
vBulletin® Version 3.8.8
Normal Logout