If you want to accept PPP connections from other IrDA-enabled devices, start pppd listening on the ircomm device that corresponds to your IrDA adapter (these devices are numbered ircommN, where N is a number from 0 to one less than the number of IrDA adapters on your system). See Chapter 7.
In most cases, you'll want more than just a PPP connection. If you want to connect to the Internet from the other device, you'll need your Linux box to act as a NAT router, and you'll also need to tell the PPP client device where it can find its name server. We've found that the following script works well (you may need to customize $LOCAL, $REMOTE, $DNS, $INTERFACE, and $IRDEV):
#!/bin/sh LOCAL=192.168.2.1 # IP address for the server running pppd REMOTE=192.168.2.2 # IP address for the device DNS=192.168.254.1 # A DNS server INTERFACE=wlan0 # Interface that connects to the network IRDEV=/dev/ircomm0 # Infrared device # Set up forwarding. # echo 1 > /proc/sys/net/ipv4/ip_forward /usr/sbin/iptables -t nat --flush /usr/sbin/iptables -t nat -A POSTROUTING -o "$INTERFACE" -j MASQUERADE # Start the PPP link. # /usr/sbin/pppd $IRDEV 115200 local $LOCAL:$REMOTE ms-dns $DNS silent noauth persist nodetach \
To connect from another IrDA-enabled Linux device, align the infrared ports and then issue the following command:
# pppd /dev/ircomm0 115200 usepeerdns local nodetach defaultroute
You may need to bring down any existing network interfaces, because the defaultroute option generally does not override existing default routes. Some versions of Linux ship with a modified pppd that lets you use the replacedefaultroute option to replace any existing default route.
To set up the connection to the Linux system:
Select Prefs
The Network preferences appear, which list the existing services; click New.
Give the new service a name and select IR to a PC/Handheld under Connection as shown in Figure 8-6.
To connect, align the infrared ports of your Linux system and the Palm. Return to Network preferences, select the service you created in Step 3, and click Connect. When you are done with the network connection, return to the Network preferences and click Disconnect.
To test out your connection, ping a remote host. To do this, stay in
the Network preferences after the connection is made and select Menu
Making a simple PPP connection is more complicated under the Pocket PC than under Palm OS. To set up the connection to the Linux system with Windows Mobile 2003.
Click the Start menu, and choose Settings
You'll be prompted to choose a name for the connection and to select a modem. Select Generic IrDA and click Next.
You'll be prompted to type in a phone number. Pick anything you wantit's just a placeholderand then click Next.
On the next screen, you'll be asked to supply a username, password, and domain. Leave these all blank and click Advanced.
On the General tab of the advanced settings, set the Baud rate to 115200 and uncheck Wait for Dial Tone before Dialing, as shown in Figure 8-9.
Click the Port Settings tab and check the box labeled Enter Dialing Commands Manually, as shown in Figure 8-10. Click OK.
You'll be back at the dialog (username, password, and domain) that you originally saw in Step 4. Click Finish to return to the Connections settings.
To connect to the Linux system, align your infrared ports, and then:
Click the Start menu and choose Settings
A list of connections appears, showing the connection that you created. Tap and hold on it to bring up a context menu and select Connect, as shown in Figure 8-11.
You'll be prompted for a username, password, and domain. Leave these blank and click Save Password to have this (hopefully) never bother you again, and then click OK.
After a few seconds, the Manual Dial Terminal should appear full of PPP gibberish, as shown in Figure 8-12. Click OK, and you should get confirmation of your connection, as shown in Figure 8-13.
You can hide this notification and make it reappear by clicking its icon at the top of the screen. Use the Disconnect button to disconnect when you are finished. Test your connection by visiting a web site with Pocket Internet Explorer.