Following 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
/etc/ppp/options
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:
ms-dns 216.148.227.62 ms-dns 204.127.202.2
(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 hcid sdptool add SP sdpd 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 10.0.0.102:10.0.0.111 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 btlan.sh and make it executable like this:
chmod +x btlan.sh
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).
Macintosh: (Panther-only)
1. Pair with the Linux machine: Turn on Bluetooth on your Mac, and then Setup a Bluetooth Device from the Bluetooth preference panel. Select “other device”, select the BlueZ device, enter the 12345 pin number as requested, and create the pairing (it’s a bit hairy procedure, sometimes doesn’t work…).
2. Open the /Applications/Utiltiies/BluetoothSerialUtility and hit “new”. Give it a name (e.g. BTLan), click “show in network preferences”, and from the port type, select rs-232. From the “Select device…” button a new window will open: select the BlueZ name and then the “LAN Access Point” option. Click Select and then Ok. Make sure the On/Off switch for BTLan on the main Serial Utility window is checked. Close that window down.
3. Go to the Preferences/Network. From the “Show” combo box, select “Network port configurations” and enable the “BTLan” option. Click Apply Now.
4. From the Show combo box again, select the BTLan option. From the TCP/IP tab, select “using PPP”. You can enter some DNS numbers there if you want btw, just in case. In the Modem tab, select the “null modem 115200” from the long list and uncheck the “wait for dial tone before dialing”. Select Apply Now. Close down the Preferences.
5. Open /Applications/InternetConnect. You should be seeing the BTLan connection name there now. Select configuration and Edit Configurations. Save that default Modem Configuration. Now, hit “connect”. You should be connected on the internet now via Arch Linux’s Bluetooth routing.
Linux machine:
After starting your bluetooth services (different for each distro, usually it’s /etc/rc.d/bluetooth start or /etc/rc.d/init.d/bluetooth start) do the following:
hcitool scan # the above will give you something like: # 00:11:22:33:44:55 BlueZ modprobe bnep # use the number found above pand -c 00:11:22:33:44:55 # this is the IP address of your Linux client, change accordingly ifconfig bnep0 10.0.0.111 netmask 255.255.255.0 # this is the address of your Arch Access Point server, change accordingly route add default gw 10.0.0.102 ifconfig bnep0 up
You should now be connected to the Internet. If not, advise Google. 😉
PalmOS devices: (text borrowed from here):
1. Pair the Palm to the Bluetooth Access Point Linux machine: in Bluetooth Preferences, tap “Trusted Devices”, “Add Device”, and select your dongle’s name from the list that appears. If it asks for your passphrase, use the pin you entered earlier: 12345.
2. In Connection Preferences, create a new connection with the following attributes: Connect To: PC, Via: Bluetooth, Device: {BlueZ}. Under Details, set the speed to 115,200 bps and Flow Ctl to Automatic.
3. In Network Preferences, create a new service. You can leave the User Name and Password fields blank. Select the connection you created in the previous step, then tap Details. Here, set the Primary and Secondary DNS servers to the same as your Server, and check the box for Automatic IP Address discovery.
4. Test the connection by tapping “Connect”. After a few messages, the connection should be made. Tap Menu->Options->View Log…, and scroll to the bottom. Here, you can test the connection by sending the following ping command: ping 10.0.0.102 (or whatever your BT server’s address is) — this will test the connection between your Palm and the Server (i.e., Gateway). You can then try pinging an IP on the Internet, or a DNS name. If both work from the server, they ought to work from the handheld as well.
Conclusion
You can also configure PC laptops, desktop PCs and PocketPCs to connect to your BT Access Point as long they have BT functionality (the Access Point works for up to 7 clients, that’s a Bluetooth protocol limitation).
Here’s a guide how to connect a Windows machine on a Bluetooth Access Point. It should be fairly easy for PocketPC too. BTW, if you instead want to share internet connection via a USB or serial cable with your PalmOS (instead of Bluetooth), check this article.
Phew… That was painfull, no matter what OS you are using. But it works. Leave a comment on the forum or directly email me if you have trouble.
I got a bluetooth ad on my phone at the mall the other day… I bet they did some thing like this, except generated messages instead of allowing internet connections. BTW, I found out that it is important to not only set your phone to non-discoverable, but also change the default name. I thought the ad was it pretty cool at the time, I bet it will get old when it catchs on.
I’ll admit to having been in the dark ages with Bluetooth, as I’ve never really had a use for it as I’ve got wireless so the internet sharing hasn’t been necessary. But now that I’ve got a mobile, PDA and other devices I’ve needed to find some way of synchronising and using the lot of them and it’s a bit of a pain to be honest.
I have a connection to the Internet with my IPaq 2210 after following the instructions.
Sure, this is a solution, but it’s not really the ‘Linux way’ of doing things.
There should be a way to enable connection sharing from the GNOME/KDE network manager panel.
Someone really needs to write a shareware app to set this up. I know I don’t want to waste hours tinkering with scripts on the command line like this.
I know theres a market for a product like this, because I would pay $10 for it.
So this isn’t the “Linux way”, but using shareware products to access relatively basic features is? Are you kidding me?
No, i’m as serious as Eugenia when it comes to making silly statements about ‘The *Insert OS Name here* Way’
It’s just that the very method that was claimed as inadequate and overly time consuming on OS X is apparently a valid approach on a Linux distro.
I mean, they’re both UNIX-like OSes with fancy graphical shells, so I don’t see why a shareware app is required on OS X but no on Linux.
Is bluetooth a good alternative to wifi for home : sharing an internet connection and a printer between 2 or 3 PCs ?
Are bluetooth adapters well supported in linux ?
No, WiFi is better is terms of speed and software/ease of use and OS support.
However, Bluetooth has a few qualities that made the creation of this Access Point a necessity (I worked all night last night to make it work properly on my Fedora/Arch and then wrote the article at 3:30 AM, I went to sleep 5 AM). The qualities are:
1. If you have a PDA that only supports BT. Most Palm-based PDAs are BT-enabled, not WiFi-enabled.
2. If you want to share internet connection with someone else on a hotel room or in a library or on a coffee shop. If that someone else has a PDA or a BT dongle for his/her laptop, but not WiFi or other means to connect, you can help him/her to get some connection too.
3. If you have an old PC laptop and especially a Mac (especially older iBooks that were not upgradable to WiFi) that doesn’t support any wireless in it, but it happened you got your hands to a BT dongle and you want to use that laptop as a wireless laptop.
Basically, BT-over-IP is good for the cases where there is no WiFi available or your client doesn’t have WiFi or other connection means, and you want to share a single connection with him/her.
>I have a connection to the Internet with my IPaq 2210 after following the instructions.
Very glad to hear.
Anyone that knows how far an avereage BT-dongle will send/recieve? Can I st this up on my Linuc-server in my basement and expect it to work in my living room (ground floor/wood house)?
Nalle, please read the article, this very thing is explained on the second paragraph of the article! Why people never read the articles before commenting?
So, it depends what dongle you buy. There are Class I, II and III dongles: Class I is the furthest of all, up to 100 meters. Class II is 10 meters and Class I is 1 meter. So, it depends how much money you want to spend.
Eugenia: (especially older iBooks that were not upgradable to WiFi)
all ibooks have had support for WiFi, that was they’re big selling point when they came out, remember? i think they might have even been the first laptops with built in WiFi.
> If you have an old PC laptop and especially a Mac
If you have USB, you can have wifi using a usb/wifi adapter.
Why do you think bluetooth is more suited in this case ?