3.3. Setting up the PPP Daemon

The pppd daemon needs to be called by a one-liner script to connect to a socket and listen for incoming connections (in this case, the serial, USB, or IrDA port). If you are sure that all of your ppp modules are working in the kernel, you can proceed. You can verify that with lsmod as follows:

broccoli:~$ /sbin/lsmod | grep ppp
ppp_async               8064   0 (autoclean)
ppp_generic            21244   0 (autoclean) [ppp_async]
slhc                    5264   0 (autoclean) [ppp_generic]

The mystery one-liner which is used to connect the Palm to the desktop running pppd is:

broccoli:~$ cat palmgo.sh
#!/bin/sh
echo -n ""
echo -n "Now launching the ppp connection to talk with your Palm device"
echo -n ""
/usr/sbin/pppd /dev/ttyS3 115200 10.0.60.116:10.0.60.200 local \
               ms-dns 10.0.60.40 netmask 255.255.255.0 persist \
               passive noauth debug -detach asyncmap 0

And broken down into it's separate components, becomes:

/usr/sbin/pppd          \  # Simply calls the binary from it's location (on my system
                           # /usr/sbin, but YMMV).

/dev/ttyS3 115200       \  # This is a reference to the port's location and port speed.
                           # The device will be located somewhere in the the /dev
                           # directory on your system. /dev/ttyS0-4 for COM1-3, and
                           # /dev/ttyUSB0..n for your USB ports, /dev/irnine
                           # or /dev/ircomm0 (depending on kernel version)  
                           # for IrDA.

10.0.60.116:10.0.60.200 \  # Local IP address. This is the machine that the cradle or
                           # HotSync cable is physically attached to. You can find this
                           # by using 'ifconfig' and using the proper interface and IP 
                           # address for your computer. The second value after the colon
                           # is the target device IP address. Whatever address you want 
                           # to give your Palm when it connects. In some cases, this    
                           # address may be simply another one on the same network (as  
                           # shown above), or a completely different address, which you 
                           # masquerade into the proper interface

local                   \  # Don't use the modem control lines. Using this will guarantee
                           # that we ignore the state of the CD (Carrier Detect) signal  
                           # from the device and will not change the state of the DTR    
                           # (Data Terminal Ready) signal.

ms-dns 10.0.60.40       \  # If pppd is acting as a server for Microsoft Windows clients,
                           # this option allows pppd to supply one or two DNS (Domain
                           # Name Server) addresses to the clients. The first instance
                           # of this option specifies the primary DNS address; the second
                           # instance (if given) specifies the secondary DNS address. I'm
                           # not sure why I had to include this, and it may not even be  
                           # necessary any longer, but it works with it, so I didn't     
                           # change it. The second value is the IP address (not hostname)
                           # of DNS you wish to use for resolving domain names to their  
                           # IP address.

netmask 255.255.255.0   \  # Set the interface netmask to n, a 32-bit netmask in "decimal
                           # dot" notation (e.g. 255.255.255.0). If these two arguments  
                           # are not given, the default netmask will be chosen based on  
                           # the negotiated remote IP address.

persist                 \  # After the connection is killed (for any reason), instead of
                           # exiting the daemon, try to reopen the connection. This
                           # causes the daemon to recycle, and offer connections back to
                           # the Palm again.

passive                 \  # Enables the "passive" option in the LCP. With this option,
                           # pppd will attempt to initiate a connection; if no reply is
                           # received from the peer, pppd will then just wait passively
                           # for a valid LCP packet from the peer, instead of exiting, as
                           # it would without this option.

noauth                  \  # Do not require the Palm to authenticate itself (different
                           # than user credentials, this is a per-connection
                           # authentication.

debug                   \  # Enables connection debugging facilities. If this option is
                           # given, pppd will log the contents of all control packets  
                           # sent or received in a readable form. The packets are logged
                           # through syslog with facility daemon and level debug. This  
                           # information can be directed to a file by setting up
                           # /etc/syslog.conf appropriately.

-detach                 \  # Don't detach from the controlling terminal. Without this
                           # option, if a serial device other than the terminal on the
                           # standard input is specified, pppd will fork to become a  
                           # background process.

asyncmap 0                 # Set the async character map to ([17]). This map describes
                           # which control characters cannot be successfully received 
                           # over the serial line.