posted by Eugenia Loli on Sun 27th Feb 2005 12:07 UTC
IconFollowing my earlier article about creating a Bluetooth access point with your OS, here is my quick guide how to do just that with Arch Linux. You will need two Bluetooth-enabled devices to start with, and some patience as setting up Bluetooth is problematic on all OSes (each one with its own quirks).

I am using the AIPTEK BTuoi USB-based Bluetooth dongle, which is Class I. Class I means that the device can send/receive up to 100 meters, Class II means 10 meters and Class III, 1 meter. Most integrated BT modules on laptops/PDAs are Class II, up to 10 meters, so if you want the best performance for the Access Point we will try to create here, buy a Linux-supported Class I dongle (about $35). In any case, any Class Bluetooth module will work anyway.

One-time configuration

Start by installing the BlueZ Bluetooth and other needed packages (all as root):

 pacman -S bluez-libs bluez-utils iptables ppp

Edit your /etc/bluetooth/pin file and enter some digits: 12345 (remove the "BlueZ" word, some devices only pair with numerical pins).

Edit your /etc/bluetooth/rfcomm.conf file and make it look like this instead of the default values:

rfcomm0 {
        # Automatically bind the device at startup
        bind yes;     # original: bind yes

        # Bluetooth address of the device
        # device 11:22:33:44:55:66
        # comment out the devices' MAC addresses

        # RFCOMM channel for the connection
        channel 3; # was channel 1

        # Description of the connection
        comment "Bluetooth Access Point";

Edit the /etc/bluetooth/hcid.conf (this is optional, but useful) and change the name line from

name "%d h%"

to something like
name "BlueZ"

Now, edit your

file with a text editor and change the "auth" with "noauth" (somewhere around line 25-30). Around line 15-20, add your DNS info, e.g. something like this:

(copy the IP addresses from your /etc/resolv.conf if you are not sure what to use, the above addresses won't work for you)

The Access Point service

All the above is needed to be done once. Here is what you need to do each time you reboot the machine and you want your Access Point to be functional:

Start the bluetooth Arch script and stop it again (it seems that this script initializes some stuff that the main script below doesn't, so just start it and stop it like this:)

/etc/rc.d/bluetooth start
/etc/rc.d/bluetooth stop

Then, run the main script:

modprobe rfcomm
modprobe hci_usb

mknod /dev/rfcomm0 c 216 0
mknod /dev/rfcomm1 c 216 1
mknod /dev/rfcomm2 c 216 2
mknod /dev/rfcomm3 c 216 3

hciconfig hci0 up
sdptool add SP
rfcomm bind all
# first IP address is the one of the server, 
# second the one of the client; change accordingly, depending on your network
dund --listen --msdun --channel 3
echo '1' > /proc/sys/net/ipv4/ip_forward
# use a different eth0 name if your server's incoming
#internet connection is coming from a different device
#(e.g. might be sit0 or ppp1, depending how your Arch Linux is connected to the outside world).
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE
iptables -A FORWARD -i ppp0 -j ACCEPT
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT

You can put all of the above in a single script too, call it and make it executable like this:

chmod +x
and then put it on your /usr/sbin/.

You are all setup (and a similar procedure works for Fedora as well) Now, you need to configure your clients to use this Bluetooth Access Point-wannabe as their server. We will try connecting to the internet via this Arch Linux-based Bluetooth Access Point with a PalmOS device, another Linux machine and a Macintosh, both Bluetooth-enabled. After setting them up, your clients will be able to even have access to your main internal network (the one your Arch Linux belongs).

Table of contents
  1. "Configuring the server, Page 1/2"
  2. "Configuring Linux/PalmOS/MacOSX, Page 2/2"
e p (0)    14 Comment(s)

Technology White Papers

See More