7.1. Surf the Web with Bluetooth


You can surf the web from your Palm, using Bluetooth over this connection you just made to your desktop machine. To do this, you'll need to have hcid, sdpd, and dund running, but it's not difficult to do. Let's get the connection started.

If you had no trouble with the previous tests and diaagnostics, communicating from Palm to desktop machine, these few steps will get you connected and allow you to surf the web with your Palm, using your desktop as a "repeater", over Bluetooth.

dund will use pppd to establish a connection with your Palm. pppd, the Point-to-Point Protocol provides a method for transmitting datagrams over serial point-to-point links. PPP is composed of three parts: a method for encapsulating datagrams over serial links, an extensible Link Control Protocol (LCP), and a family of Network Control Protocols (NCP) for establishing and configuring different network- layer protocols.

The encapsulation scheme is provided by driver code in the kernel. pppd provides the basic LCP, authentication support, and an NCP for establishing and configuring the Internet Protocol (IP) (called the IP Control Protocol, IPCP).

Let's test that this actually works, quick and easy. Open up a terminal, and run the following command (assuming Linux here, and you'll need to be root to do this):

			wrath:~# echo 1 > /proc/sys/net/ipv4/ip_forward
			
		  

This quick command will enable IP Forwarding (assuming your kernel is built with this support, of course, and most should be), so any traffic coming from your Palm, to your desktop, will be "forwarded" on to the destination; in this case, the Internet. Don't close this terminal though, we're going to use it again in a second.

Now, launch hcid and sdpd:

			wrath:~# hcid
			   wrath:~# sdpd
			
		  

Both of these daemons will simply launch and return without generating any output. But rest assured, they'll be doing their jobs in the background.

Next, you need to create a file that dund will use. Put the following lines in a file called /etc/ppp/peers/dun

			115200
			   10.0.1.8:10.0.1.40
			   local
			   ms-dns 128.100.100.128
			   noauth
			   debug
			
		  

Now, you are ready to launch dund and establish a connection from your Palm. First, we'll run dund with the --nodetach option so that we can see that things worked okay.

			wrath:~# dund --nodetach --listen --persist --msdun call dun
			
		  

While this is running, we'll establish the connection from your Palm. Just go to your Prefs->Network application and select your new "Unix" profile (the one we set up in the previous section, to communicate over Bluetooth), and tap on "Connect".

WHOA! What was all that? Well, I'll explain each of those in a second. If it did successfully connect, you should have seen it report something similar to the following:

			dund[1711]: New connection from 00:07:E0:0E:F6:F4
			   Perms of /dev/rfcomm0 are ok, no 'mesg n' neccesary.
			   using channel 2
			   Using interface ppp0
			   Connect: ppp0 <--> /dev/rfcomm0
			   sent [LCP ConfReq id=0x1 <asyncmap 0x0> <magic 0xb9188300> <pcomp> <accomp>]
			   rcvd [LCP ConfRej id=0x1 <magic 0xb9188300>]
			   sent [LCP ConfReq id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
			   rcvd [LCP ConfAck id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
			   sent [LCP ConfReq id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
			   rcvd [LCP ConfAck id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
			   rcvd [LCP ConfReq id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
			   sent [LCP ConfAck id=0x2 <asyncmap 0x0> <pcomp> <accomp>]
			   sent [LCP EchoReq id=0x0 magic=0x0]
			   sent [CCP ConfReq id=0x1 <deflate 15> <deflate(old#) 15>]
			   sent [IPCP ConfReq id=0x1 <compress VJ 0f 01> <addr 10.0.1.8>]
			   rcvd [IPCP ConfReq id=0x1 <addr 0.0.0.0> <compress VJ 03 01> <ms-dns1 0.0.0.0> <ms-dns3 0.0.0.0>]
			   sent [IPCP ConfNak id=0x1 <addr 10.0.1.40> <ms-dns1 128.100.100.128> <ms-dns3 128.100.100.128>]
			   rcvd [LCP EchoRep id=0x0 magic=0x0]
			   rcvd [LCP ProtRej id=0x3 80 fd 01 01 00 0c 1a 04 78 00 18 04 78 00]
			   rcvd [IPCP ConfNak id=0x1 <compress VJ 03 01>]
			   sent [IPCP ConfReq id=0x2 <compress VJ 03 01> <addr 10.0.1.8>]
			   rcvd [IPCP ConfReq id=0x2 <addr 10.0.1.40> <compress VJ 03 01> <ms-dns1 128.100.100.128> <ms-dns3 128.100.100.128>]
			   sent [IPCP ConfAck id=0x2 <addr 10.0.1.40> <compress VJ 03 01> <ms-dns1 128.100.100.128> <ms-dns3 128.100.100.128>]
			   rcvd [IPCP ConfAck id=0x2 <compress VJ 03 01> <addr 10.0.1.8>]
			   Cannot determine ethernet address for proxy ARP
			   local  IP address 10.0.1.8
			   remote IP address 10.0.1.40
			   Script /etc/ppp/ip-up started (pid 1723)
			   Script /etc/ppp/ip-up finished (pid 1723), status = 0x0
			
		  

We used several options in the /etc/ppp/peers/dun file. The important things to remember here are the local:remote IP address and the DNS server entry. In the example above, 10.0.1.40 is the IP that gets assigned to the Palm when it connects, 10.0.1.8 is the physical IP of the box I ran pppd on, and 128.100.100.128 is the DNS server I am using. Use the appropriate values for your own network and Palm setup.

The rest of the values can be found in the pppd manpage, or covered in my other HOWTO called Connecting your PalmOS® handhdeld device to the Internet via PPP. Feel free to read that HOWTO as well, to fully understand how this all works.

If you successfully connected via ppp, and received output similar to the above, you can now surf the web via Bluetooth from your Palm! You can now run the same dund command, but without the --nodetach option. This will cause it to run in the background so you won't have to launch it each time you want to connect.

Figure 7-1. Surfing the web over Bluetooth