This page has been archived and some links may not work correctly anymore. No updates of this page will be done anymore.
Internet connection sharing for HP Palmtops
Or: How to connect a handheld or other PC via serial line to a PC to use its Internet connection
Especially: Sharing an HP Omnibook 800CT wireless LAN access over IrDA with an HP 200LX palmtop
Contents of this page:
- Windows Server setup (MochaPPP)
- Linux server setup (pppd and IP masquerading / forwarding)
- Client setup
If you have a PC at your home or at work which is connected to the Internet via a fast and reliable connection, such as DSL, Ethernet, ATM, X25 or even via modem or ISDN, and if you have a handheld computer which you also want to connect to the Internet from time to time, for up- and downloading emails, for example, you may not want to establish an extra expensive Internet connection via modem or GSM, but rather want to make use of the existing connection.
This is possible. I will describe here how to set up a PC running Linux or Windows so that you can connect your handheld via serial port or IrDA to the PC and use the Internet connection of the PC also with your handheld.
Since I use the HP 200LX palmtop and only Linux on my PCs, I will focus mostly on these points of view, but I will also describe how to set up Windows on the "server" side and any communication software on the "client" side.
Windows server: MochaPPP:
First download MochaPPP from http://www.mochasoft.dk/download.html (look for the "Mocha W32 PPP" in the "Palm and Visor" section) and install it on your Windows machine.
- run the program MPPP.EXE.
- Set speed to 38400 (once this works you can go higher and explore the limits, make sure you have always set the client machine to the same speed!)
- Tell MochaPPP what device you use (if you use the HP 200LX palmtop, tell MochaPPP it was a WinCE device)
- Since I have never worked with MochaPPP I cannot say exactly how to set it up for an IrDA connection, but since Windows usually assigns a virtual COM port to an IrDA interface, you should probably simply shoose this virtual COM port as the port to be used by MochaPPP.
- Then connect your already configured client device to the PC. Use a nullmodem cable, not a straight-through serial cable! For more information about these different kinds of cables, also related to the palmtop HP200LX, please see my RS232 page!
Unfortunately, Windows 2000 and Windows XP use another driver concept as the older Windows versions, so there is no "virtual COM port" assigned to an IrDA device anymore. There are thiird party drivers to solve this problem:
- A free open-source solution: http://www.ircomm2k.de
- The commercial IrComm2000 driver: http://www.extendedsystems.com
Linux server: pppd and IP masquerading / forwarding:
Assuming you have already a working internet connection, I will now guide you through the steps necessary to share that Internet connection with a device attached to the serial port or IrDA port of your linux machine.
The short story
A simple shell script can do the job under certain circumstances. I suggest you to try that way first, and if it doesn't work, use the detailled instructions below.
#!/bin/sh # Setup IP masquerading on your Internet connection network device # (change "wlan0" to the appropriate device, e.g. ppp0, eth0, ippp0...): iptables -t nat -A POSTROUTING -o "wlan0" -j MASQUERADE # This is for IrDA connection on an HP Omnibook 800 notebook only # comment it out if you don´t use an Omnibook 800: modprobe vlsi_ir # This is for IrDA connections only (not only Omnibook 800) # comment it out if you use a serial connection instead of IrDA: ifconfig irda0 up # This is the PPP server (PPPD) call within an infinite loop: while [ 1 ] do /usr/sbin/pppd /dev/ircomm0 38400 172.16.96.10:172.16.96.11 proxyarp local noauth silent nodetach ktune ms-dns 126.96.36.199 done
Adapt the pppd line to your needs:
- /usr/bin/pppd is the location of the pppd binary,
- /dev/ircomm0 is the name of the port where the device is connected which shall use the Linux computer's Internet connection. (/dev/ttyS1 for "COM2", /dev/ttyS0 for "COM1", /dev/ircomm0 for an IrDA port...),
- 38400 is the baud rate, you can probably go higher, but try this one first,
- the following two IP addresses are the one pppd uses on the Linux machine and the one the client should get. You can probably use the ones used here, except you already have a private subnet which uses these IP addresses. They must be unique in your subnet.
- proxyarp tells pppd to handle ARP requests on behalf of the connected device
- local Tells pppd not to use modem control features.
- noauth Bypasses all authentication. You can also set it up to use e.g. CHAP or PAP. But noauth should be enough for private use it you do not use a dialup connection between the Linux PC and the device which you connect
- silent Tells pppd to wait for the connecting device to send LCP packets rather than trying (and failing) when no device is connected. Replaces the 'passive' option in older versions.
- nodetach Tells pppd to stay attached to the controlling terminal rather than forking off as a background process. We want ONE pppd in charge of this vty!
- ktune tells the kernel to enable IP forwarding
- ms-dns xxx.xxx.xxx.xxx Tells pppd to send our DNS server (188.8.131.52 in my case) parameters to the attached device. This avoids having to hard-code values on the client, in case things change.
This shell script needs the executable "iptables", a newer version of pppd which supports the ktune parameter and the NAT (network address translation) kernel modules.
Usage: Simply adapt this script to your needs and start it. If it leads to error messages, try to find the reason. If it doesn´t, connect the device which should participate in the internet connection of the Linux computer and let it connect. When you don´t need the Internet connection sharing anymore, stop the script by pressing (and maybe holding for some seconds) Ctrl-C.
If this setup doesn´t work for some reason, or if you want a more sophisticated setup where you don´t need to manually start a script, read on!
The long story
Attention: The following things have to be done as root, so be careful!
The first thing you need is the ability of Linux to share its Internet connection at all. This is done by a mechanism called IP forwarding and IP masquerading. If you want to learn more about these techniques, please read the IP masquerading howto. There are more than one way to setup IP masquerading and forwarding, please consult the manuals and docs of your Linux distribution to learn how to do it in a distribution-specific way. I describe it here in a generic way which should work for all distributions using a recent kernel version (i.e. 2.4.0 or above). If you have another kernel version, you should read the IP masquerading howto.
First, switch on everything which is necessary for IP forwarding and masqerading in the kernel configuration and compile a new kernel. Maybe this is not necessary in some cases. If you don´t feel comfortable compiling a new kernel, don't do it first and try if it works with your current kernel. You need to go into the "networking options" and switch the netfiler on. Then in the netfiler section everything related to NAT and IP forwarding has to be enabled.
My relevant sections in /usr/src/linux/.config look like this:
# # Networking options # CONFIG_PACKET=y # CONFIG_PACKET_MMAP is not set CONFIG_NETLINK=y CONFIG_RTNETLINK=y CONFIG_NETLINK_DEV=m CONFIG_NETFILTER=y # CONFIG_NETFILTER_DEBUG is not set # CONFIG_FILTER is not set CONFIG_UNIX=y CONFIG_INET=y CONFIG_IP_MULTICAST=y # CONFIG_IP_ADVANCED_ROUTER is not set # CONFIG_IP_PNP is not set # CONFIG_NET_IPIP is not set # CONFIG_NET_IPGRE is not set # CONFIG_IP_MROUTE is not set # CONFIG_ARPD is not set # CONFIG_INET_ECN is not set # CONFIG_SYN_COOKIES is not set # # IP: Netfilter Configuration # CONFIG_IP_NF_CONNTRACK=m CONFIG_IP_NF_FTP=m CONFIG_IP_NF_QUEUE=m CONFIG_IP_NF_IPTABLES=m CONFIG_IP_NF_MATCH_LIMIT=m CONFIG_IP_NF_MATCH_MAC=m CONFIG_IP_NF_MATCH_MARK=m CONFIG_IP_NF_MATCH_MULTIPORT=m CONFIG_IP_NF_MATCH_TOS=m CONFIG_IP_NF_MATCH_TCPMSS=m CONFIG_IP_NF_MATCH_STATE=m CONFIG_IP_NF_MATCH_UNCLEAN=m CONFIG_IP_NF_MATCH_OWNER=m CONFIG_IP_NF_FILTER=m CONFIG_IP_NF_TARGET_REJECT=m CONFIG_IP_NF_TARGET_MIRROR=m CONFIG_IP_NF_NAT=m CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_TARGET_MASQUERADE=m CONFIG_IP_NF_TARGET_REDIRECT=m CONFIG_IP_NF_NAT_FTP=m CONFIG_IP_NF_MANGLE=m CONFIG_IP_NF_TARGET_TOS=m CONFIG_IP_NF_TARGET_MARK=m CONFIG_IP_NF_TARGET_LOG=m CONFIG_IP_NF_TARGET_TCPMSS=m CONFIG_IP_NF_COMPAT_IPCHAINS=m CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IP_NF_COMPAT_IPFWADM=m CONFIG_IP_NF_NAT_NEEDED=y CONFIG_IPV6=m
Also make sure the driver for the serial port and / or IrDA interface is included into the kernel or compiled as module. I assume it works already. If not, please make it work before you go on. Especially an IrDA driver may be a bit tricky to set up. I use the HP Omnibook 800CT with its IrDA driver vlsi_ir by Martin Diehl to share the wireless LAN access with my HP 200LX palmtop. Please note that the vlsi_ir driver is included in the Linux kernel since version 2.4.9. In order to make IrDA work on my Omnibook I use this script:
#!/bin/sh modprobe vlsi_ir modprobe ircomm ifconfig irda0 up echo "1" > /proc/sys/net/irda/discovery echo Discovery says: cat /proc/net/irda/discovery
(The last three lines are optional. They show you if another device is in the range of the IrDA interface. You will see the name it identifies itself with.)
In order to set up the netfilter, you need the iptables package (if you do not have it already), which you can download at http://netfilter.samba.org/. I use version 1.2.4.
Also you need the pppd (PPP daemon), which is certainly part of your Linux distribution.
Now we can start setting the whole thing up. In order to enable IP forwarding and masquerading, execute
echo 1 > /proc/sys/net/ipv4/ip_forward /usr/local/sbin/iptables -t nat -A POSTROUTING -o "eth0" -j MASQUERADE
The first line enables forwarding (not necessary when using a recent version of pppd! The pppd parameter ktune can do that job for you!), the second line enables masquerading. Replace eth0 by your network device which is connected to the Internet. (Probably ppp0 if you use a dial-up connection, ippp0 for ISDN, wlan0 for wireless LAN...., find out with "ifconfig" while you have an active Internet connection). the iptables binary may be placed on another location than /usr/local/sbin - change that if necessary.
Palmtop user Ed Padin reported success using ipchains instead of iptables using this command:
ipchains -l forward -j MASQ
If you have troubles starting iptables, try to unload the ipchains module, which can disturb iptables (rmmod ipchains).
You can put the IrDA module calls and the iptables / ipchains setups into /etc/init.d/boot.local, so it is executed automatically at boot time.
Now you must set up the Linux computer as a PPP server for the attached device, using the pppd. This can either be done using a simple pppd call from a shell script as described above, or you can use init to start the pppd as a deamon in background. Here is an example how to call it for runlevels 2,3,4 and 5:
Append a line to /etc/inittab:
palm:2345:respawn:/usr/sbin/pppd /dev/ircomm0 38400 172.16.96.10:172.16.96.11 proxyarp local noauth silent nodetach ktune ms-dns 184.108.40.206
(Adapt the parameters as described above) When you have appended this line to the inittab, run a telinit q to let the system reread the file and use the new settings. maybe a killall pppd is necessary to kill an old pppd and to let the new one start automatically after a change of parameters. You can check easily if the correct pppd runs by typing ps -x | grep pppd.
That´s it. After configuring your client device you should be able to use the PC´s Internet connection over the serial port. Click here to jump to the client setup guide.
In general you can use any software on the client machine which is able to talk the PPP protocol over the serial port or the IrDA port. For setting up a Palm, please go to the top of this page and follow the Palm link under "Related pages". Here I will describe the process of setting up the WWW/LX software on the HP 200LX palmtop, but this should also show how to set up every other piece of software.
Here are the relevant parts from my WWW/LX config file www.cfg:
[Setup] ... PPPD_linux_IR=pppd on linux Omnibook IrDA [pppd_script] s=\r @=3 [PPPD_linux_IR] Port=-1 OmniGo=0 PPP=1 Modem=0 Baud=38400 My_IP=0.0.0.0 DNS_IP=0.0.0.0 DNS2_IP=0.0.0.0 Script=pppd_script ModemInit= Dial= Login= Password=
- The Setup entry is WWW/LX specific and only adds a short description to the setup name.
- [pppd_script] is the script WWW/LX uses when connecting over the serial line. It is a very simple script which does the following:
- s=\r -- send a carriage return (= press the Enter key)
- @=3 -- pauses for 3 seconds before PPP connection begins.
- The remaining lines are the settings WWW/LX uses for the connection:
- Port=-1: Use port COM1 and set it to IrDA mode. Attention: On the HP 200LX this is only possible with WWW/LX, not with pther software, because the IrDA protocol is totally implemented in software, there is no generic IrDA support by that device! See also my IrDA page! Use Port=1 for a wired serial port connection (i.e. on the Server side /dev/ttySx or COMx).
- PPP=1: Use the PPP protocol
- Modem=0: Use a direct serial line
- Baud=38400: Must match the speed setting on the Server side!
- MY_IP, DNS_IP, DNS2_IP=0.0.0.0 tells WWW/LX to determine the correct values during the login process. You can also give it statically here if you have troubles with the dynamical setup. The dynamical setup has the advantage that you have to change it only on the server side if something changes.
- Script=pppd_script: The script to use for the login process
- ModemInit=, Dial=, Login=, Password=: Since no authentication and no modem is used, these parameters do not need any value.
Attention WWW/LX users who use setcom.bat in conjunction with modem.com to let the palmtop determine automatically the necessary WWW/LX settings: Since a wired connection to a Linux PC running pppd (and eventually even MochaPPP on Windows machines) causes modem.com to think there is a modem and let setcom.bat then execute wwwset.exe with your modem settings, make sure these settings do not interfere with your remaining setup for this kind of connection!