Share internet and TCP/IP services over Bluetooth

Nov 27, '03 09:25:00AM

Contributed by: tommedia

The following instructions allow you to share single internet connection with multiple Bluetooth equipped Macs and devices. Using Personal File Sharing service in Mac OS X, you can connect to your server with a client computer equipped with Bluetooth through the Connect to Server command. This hint was built on previous hints regarding sharing internet to a Palm device, sharing internet with a Mac over a Bluetooth phone, and other info found on the web and on this site. I'm not a programmer nor am I a network administrator type, so excuse me if I make some newbie type mistakes here and have a few questions there. I do know the web a little and like Macs a great deal.

One Mac (acting as a server) connected to the Internet via a Bluetooth modem (56k). It is a B&W G3 300, OS X 10.2.6 (latest OS version I've tested). This should work with any mac with a Internet connection. The Bluetooth USB adapter has a Class 1 Radio.

The Setup
Make sure you have the following software installed and configured on the Mac acting as a server. My suggestion is to install the Palm conduit and iSync even if you don't have a Palm device. This is because the Techno Happy Meal Script uses the Palm conduit to initiate the PPP connection -- you will need to edit the AppleScript if you don't want to download and install the iSync Palm Conduit. Most recent versions now install the conduit automatically. Use the Bluetooth Serial Utility too, if the port is installed.

Read the rest of the article for the remainder of the how-to...

On the Mac that acts as a server for your network (the one connected to the internet), create a Bluetooth Serial Port to share the connection over.

  1. Open Bluetooth Serial Utility
  2. Make new port by clicking the new button.
  3. Name the port "sharing-port"
  4. Port direction is incoming
  5. Require Authentication unchecked
  6. Require Encryption unchecked
  7. Show In Network Preferences unchecked
  8. Port Type Serial
  9. Click OK and you should see the port name selected with check mark in the list. Quit Bluetooth Serial Utility
Once you are connected to the internet:
  1. Use System Preferences -> Sharing -> Internet (tab) and click to start sharing the internet over Ethernet.

  2. Run the modified TechnoHappyMeal script. This script initiates a PPP server on the Bluetooth port and shares the internet connection from the Ethernet port. You will need to authenticate this with the name and password. Courtesy of www.technohappymeal.com (the first line is split in two; enter it as one with no extra spaces):
    
    do shell script "sudo /usr/sbin/pppd /dev/tty.Bluetooth-PDA-Sync 115200 noauth local
      passive proxyarp asyncmap 0 silent persist :10.0.1.201 &" with administrator privileges
    do shell script "sudo /usr/sbin/sysctl -w net.inet.ip.forwarding=1"
    do shell script "sudo /usr/sbin/natd -same_ports -use_sockets -log -deny_incoming -interface en0"
    do shell script "sudo /sbin/ipfw add divert natd ip from any to any via en0"
    
    This will enable a Palm OS device to connect and share the internet.

  3. Open the Terminal and type sudo /usr/sbin/pppd /dev/tty.sharing-port 115200 noauth local passive proxyarp asyncmap 0 silent persist :10.0.1.202This will require authentication and initiate another PPP server listing over sharing-port. Now type ps -ax | grep pppd | grep -v grep to see the ports running. If you see something like this the you are serving over Bluetooth:
    0:00.03 /usr/sbin/pppd /dev/tty.sharing-port 115200 noauth local passive proxyarp
      asyncmap 0 silent persist :10.0.1.202
    0:00.10 pppd serviceid 5 plugin /System/Library/SystemConfiguration/PPPController.bundle/
      Contents/PlugIns/PPPDialogs.ppp logfile /tmp/ppp.log plugin
    0:00.03 /usr/sbin/pppd /dev/tty.Bluetooth-PDA-Sync 115200 noauth local passive proxyarp
      asyncmap 0 silent persist :10.0.1.201
    
    If you don't want to run the Palm stuff or iSync, then don't, but you must replace the line sudo /usr/sbin/pppd /dev/tty.Bluetooth-PDA-Sync 115200 noauth local passive proxyarp asyncmap 0 silent persist :10.0.1.201 & with sudo /usr/sbin/pppd /dev/tty.sharing-port 115200 noauth local passive proxyarp asyncmap 0 silent persist :10.0.1.201 &.
Note: If you need to HotSync (Palm users) again or use your Bluetooth for something else, you need to first stop the internet sharing. Then, you can either restart the Mac or stop the PPP server manually. To stop it manually, go to the Terminal and type ps -ax | grep pppd | grep -v grep this will show you the PPP servers running. Find the Process ID and use sudo kill PID#. You'll need the root password.

Making a connection to the Bluetooth Server with client devices:
A Palm OS T2 with built in Bluetooth. Make a connection using Prefs -> Connection -> New. Edit Connection. Name the Connection (use the server's name). Select Connect to: PC, Via: Bluetooth, Device: tap to find you device. Under Detail, set the connection speed to 115,200 bps, Flow Control to Automatic. Now, go back to the Communication Preferences and click on Network. Create a new Service and call it something like "Bluetooth Over PPP." Leave username and password blank. For Connection, select the connection that you created above. Click Details, and use the following settings: Select Connection type: PPP , Idle timeout: Never, Query DNS: unchecked. Find your DNS addresses (go in to the Terminal and type more /etc/resolv.conf and look for the xxx.xxx.xxx.xxx addresses and enter them in the Primary and Secondary DNS fields. IP Address: check Automatic (or try 10.0.1.201). Tap Connect . Check on the Internet for troubleshooting tips as there are a lot out there.

Here are my client configurations: Create a modem port to share the Internet with Bluetooth Serial Utility:
Open Bluetooth Serial Utility. Make new port by clicking the new button. Name the port "BluetoothInternet-Port" or something you'll remember. Port direction is Outgoing. This is the most important part. Make sure to select the right service port (in this case the name is "sharing-port") from the services directory of the server you're connecting to. Require Authentication unchecked (may need this in Panther?). Require Encryption unchecked. Show In Network Preferences checked. Port Type Modem. Click OK and you should see the port you just created. Quit Bluetooth Serial Utility.

In the System Preferences -> Networking panel, create a new location called MyBluetoothNetwork. You should see a dialogue saying a new port has been detected. Click OK and set up your Network Port Configuration by checking on BluetoothInternet-Port. Use Show BluetoothInternet-Port and use the following settings under PPP tab. TCP/IP make sure you enter a DNS Server; all other are provided by server. Find your DNS addresses, go in to the Terminal and type more /etc/resolv.conf and look for the xxx.xxx.xxx.xxx addresses and enter them in the above fields. PPP - leave blank, Proxies - leave blank, Bluetooth Modem - Select Null Modem 115200, Check Enable error correction and compression in modem, un-check wait for dial tone, check Show Bluetooth status in menu bar, check Show modem status in menu bar, click Apply Now.

Using the top menu bar select Connect. You should now be connected shown by the Bluetooth icon in the menu bar. Make sure Personal File Share is on and use the Connect to Server command to connect to server volumes using AFP. You can find the server IP from the System Preferences -> Networking -> Ethernet panel of the serving computer. Find your DNS addresses, go in to the Terminal and type more /etc/resolv.conf and look for the xxx.xxx.xxx.xxx addresses and enter them in the above fields. Open Term and type ps -ax | grep pppd | grep -v grep to see the ports running.

Comments (13)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20031117142051675