Share an internet connection with a Bluetooth device

Nov 03, '02 09:22:12AM

Contributed by: kf6gpe

While Bluetooth is well supported in Mac OS X and many handheld computing devices, it's not immediately obvious how you can configure Mac OS X to provide Internet Sharing to Bluetooth-enabled handheld devices.

This work builds on this hint, which enables internet sharing at startup. Now we'll show how to configure a Mac OS X 10.2 system to act as a Bluetooth Internet access point for Palm Powered handhelds (and, presumably, other devices) that can use the Bluetooth Serial Profile to establish a PPP connection.

[Editor's note: This is a somewhat long and involved hint, and I have not tested it (as I don't have any Bluetooth devices). If you try it, please post a comment with your experiences and any corrections to what are probably my editing errors!]


In developing this procedure, I used the following hardware:

You will need administrator privileges on your Mac OS X computer. You should be moderately comfortable using Terminal and your favorite text editor (such as vi, pico, or emacs to edit and change system files. You will also need an IP address for your Palm Powered handheld. Typically, you can allocate one from either the 10.0.1 or the 192.168.1 subnets. Be sure that the IP address you select is not taken by another host on your local area network.

I've tested these instructions on a Power Macintosh G4 desktop with a dedicated ethernet connection and a Macintosh PowerBook G4 with an Airport connection. In both configurations the system operated as described.

Theory of Operation

Mac OS X provides Internet Routing functionality that lets Mac OS X route network packets between any two interfaces, such as the Ethernet and an Airport card. Fortunately, Mac OS X also includes pppd, a PPP server that can provide an Internet connection over a serial link.

Bluetooth, on the other hand, defines a series of connection types called profiles. One profile, the Serial Device Profile, is a mode that emulates a serial cable between two Bluetooth-enabled devices.

By using Mac OS X's Internet Routing with a PPP server over Bluetooth, a Mac OS X host can share its Internet connection with a Bluetooth-enabled device. The trick is to configure Mac OS X to use PPP over Bluetooth to listen for an incoming connection from the Bluetooth enabled device, and then use Bluetooth on the device to connect to the PPP server running on the Mac OS X box.

Basic Installation

Before you begin, you should ensure that your Palm Powered handheld can communicate with your Macintosh via Bluetooth. To do this:
  1. Install the Bluetooth drivers that come with your Palm Powered handheld's Bluetooth adapter according to the instructions that came with the adapter
  2. Install your Mac OS X Bluetooth adapter in accordance with the instructions that came with the adapter.
  3. Pair your Palm Powered handheld and Macintosh. On the Palm, select Preferences -> Bluetooth, touch Trusted Devices, touch Add Device, and select your Macintosh. Enter a PIN in the Palm, and enter the same pin on the dialog that appears on your Macintosh.
Macintosh Installation

To configure your Macintosh, do the following:
  1. Install your Bluetooth adapter.

  2. Launch the Terminal.

  3. Edit /etc/hostconfig with your favorite text editor. You will need to use the sudo command to edit this file. Add an entry at the bottom looking like this:
  4. Create a new startup items directory that will contain the commands to activate Internet Sharing and the PPP daemon on the Bluetooth interface on boot.
     % cd /Library/StartupItems/
    % sudo mkdir ISharing
    % cd ISharing
  5. Using your favorite editor and sudo, create the file ISharing with the following contents:
    . /etc/rc.common
    # Start up Internet Sharing
    if [ "${ISHARING:=-NO-}" = "-YES-" ]; then
    ConsoleMessage "Starting Internet Sharing"

    ConsoleMessage "Starting PPP/Bluetooth"
    /usr/sbin/pppd /dev/tty.Bluetooth-PDA-Sync 115200
    noauth local passive proxyarp asyncmap 0 silent persist
    : &
    Replace the address with the address you allocated for your Palm Powered handheld.

  6. Using sudo and your favorite text editor, create the file StartupParameters.plist with the following contents:
    Description = "Internet Sharing";
    Provides = ("ISharing");
    Requires = ("Network", "NetworkExtensions", "Resolver");
    OrderPreference = "Late";
    Messages =
    start = "Starting Internet Sharing";
    stop = "Stopping Internet Sharing";
  7. To ensure that the files you've created have the correct permissions and ownership, perform the following commands:
     % sudo chmod 755 ISharing
    % sudo chown root:wheel ISharing
    % sudo chown root:admin StartupParameters.plist
  8. Reboot your Macintosh.
Your Macintosh should now be running a PPP server on your Bluetooth interface. You can check this by launching Terminal and using ps:
 % ps -ax | grep pppd | grep -v grep
You should see a line corresponding to the PPP server process.

Palm Powered Handheld Installation

Configuring your Palm Powered Handheld is fairly straightforward.
  1. Launch the Prefs application on your Palm Powered handheld.
  2. Select the Connection panel.
  3. Touch the New... button.
  4. Give the new connection a descriptive name such as Bluetooth to Macintosh.
  5. Set Connect to to PC.
  6. Set Via to Bluetooth.
  7. Touch the box labeled Tap to Find and select your Macintosh.
  8. Touch Details....
  9. Set Speed to 115,200 bps.
  10. Set Flow Ctl to Automatic.
  11. Touch OK twice to return to the Connection panel.
  12. Select the Network panel.
  13. Choose the UUNet service. Rename it something descriptive, such as Bluetooth to Macintosh.
  14. Set Connection to the connection you just created previously in this section.
  15. Leave the User Name and Password entries blank.
  16. Touch Details... and ensure that Conection type is set to PPP and IP Address is checked. Uncheck Query DNS and enter the addresses of local Primary and Secondary DNS servers for your network.
  17. Set the Idle timeout to however long you'd like the connection to remain active before timing out.
  18. Touch Script... and make sure that the only entry in the script is End.
  19. Touch OK twice.
You should now be able to connect to the Internet using Bluetooth on your Palm Powered handheld by touching Connect in the Connection panel or by using any TCP/IP application.

Food for ThoughtObligatory Warning

I offer the following information to you free of charge with the understanding that I do not make any warranty, express or implied, regarding this procedure, including fitness for a particular purpose.

Comments (59)

Mac OS X Hints