Gonzalo A. de la Vega

Electronics Engineer

Home

Electronics

Linux

Software

Links


Enabling NAT (make a gateway)
Syncing your Palm
Connect your Palm to internet via Bluetooth with Fedora Core 3 (deprecated)



Enabling NAT

In order to let other devices (PC, handheld) to connect to internet through a linux box, you need to turn it into a gateway. Pasting the following into a script and running it will do the job:

OUTETH=eth0
OUTIP=1.2.3.4

iptables -t nat -F; iptables -t mangle -F
iptables -t nat -A POSTROUTING -o $OUTETH -j SNAT --to $OUTIP
echo 1 > /proc/sys/net/ipv4/ip_forward
#Basic security options not to trust
iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A INPUT -m state --state NEW -i ! $OUTETH -j ACCEPT
iptables -P INPUT DROP
iptables -A FORWARD -i $OUTETH -o $OUTETH -j REJECT

Remeber to replace the OUTETH value with your internet interface (eth0, ppp1), and the OUTIP address you have been assigned.

This was taken from the Masquerading-Simple-HOWTO  form The Linux Documentation Project (TLDP).

Then configure the other PCs to use the gateway as gateway ;-)

WARNING: this pitables configuration is quiet basic, don't trust it. Read iptables manual for more and have a look at TLDP's network section.

Syncing your Palm

The main problem is to get the USB Palms to Sync. That's because the /dev/ttyUSB0 and /dev/ttyUSB1 devices created and available only after HotSync button has bee pressed, and dissapear as soon as the operation ends or fails. This devices are mannaged by the udev system.
To make it quick:
If you wan't to know how this works have a look at udev manpage (just type man udev).
After that you can sinchronize by pressing the button on the cradle and: See pilot-xfer man page.

Connect your Palm to internet via Bluetooth with Linux (deprecated)

DEPRECATION NOTE: it is quiet easy to do this, at least with Fedora (6 and up, at least).
NOTE FOR NON FEDORA USERS: If you don't have Fedora Core, you may still follow this instructions but you may have to download some software, and find files that may be in diferent locations than stated here.
This is quick instrucion sequence to get your Bluetooth enabled Palm (actually only TT has been proved) to internet using a bluetooth adapter (I have a Belkin F8T001 USB BT adapter).

You will need to have the following packages installed:
You will also need the rfcomm module, that already comes with the kernel, so if you have not rebuild your kernel you should already have it. If you don't know what I'm talking about, nevermind you are ready.

You need to be root to do this.

Let's get it working

First you need a working BT adapter, working on your PC.

To find out if it is working run the following command:
hciconfig -a

you will see something like this

hci0:   Type: USB
        BD Address: 00:0A:3A:58:BB:B5 ACL MTU: 192:8  SCO MTU: 64:8
        DOWN
        RX bytes:62806 acl:1278 sco:0 events:1916 errors:0
        TX bytes:277634 acl:2326 sco:0 commands:23 errors:0
        Features: 0xff 0xff 0x0f 0x00 0x00 0x00 0x00 0x00
        Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
        Link policy: RSWITCH HOLD SNIFF PARK
        Link mode: SLAVE ACCEPT

that means you have a working HCI device

Next you need a few services running:
If you have a look at Fedora's /det/init.d/bluetooth file, you'll see some more programs getting executed, but those are not necesary here.

The first two daemons can be launched just by tiping the names, they need no arguments here. To change the PIN edit :
/etc/bluetooth/pin

pppd will need some arguments, you can write them on the console, or save the to file (recomnded):

debug
115200
# IP address of PC : IP address to be assigned to Palm
192.168.2.1:192.168.2.2
ktune
noauth
local
nodefaultroute
noipx

Just copy these and paste into a file, e.g
/etc/ppp/peers/dun

you could change the IP addresses but the not mandatory.

Then do this:
hcid
sdpd
dund -s call dun

where the last parameter, dun, is the name of the file you saved under the peers directory.

At this point your computer is ready to recieve BT connections. To let the Palm go through the PC to the internet you need NAT enabled.

On your Palm

You need an apropriate BT connection.
Go to Preferences->Bluetooth
Now on Preferences->Connection
Finally go to Preferences->Network

Time to try it

Now, to see what happens, have a look at the system log:

tail -f /var/log/messages

Hit connect on your Palm's Network manager. You'll get something like this:

Apr 12 12:38:10 banzai pppd[8556]: pppd 2.4.2 started by root, uid 0
Apr 12 12:38:10 banzai dund[8542]: New connection from 00:07:E0:09:A3:6E
Apr 12 12:38:10 banzai pppd[8556]: Using interface ppp0
Apr 12 12:38:10 banzai pppd[8556]: Connect: ppp0 <--> /dev/rfcomm0
Apr 12 12:38:13 banzai pppd[8556]: local  IP address 192.168.2.1
Apr 12 12:38:13 banzai pppd[8556]: remote IP address 192.168.2.2

That means you are on.

To get everything running on startup configure the following services should load:
NOTE: bluetooth must run first.

Enjoy your connection.


1
Hosted by www.Geocities.ws

1