Linux Unwired [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Linux Unwired [Electronic resources] - نسخه متنی

Edd Dumbill, Brian Jepson, Roger Weeks

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید










8.4 Sharing a Network Connection over IrDA



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 \


8.4.1 Connecting from Linux



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.



8.4.2 Connecting from Palm OS



To set up the connection to the
Linux system:



Select Prefs Communication Network (Figure 8-5)



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.




Figure 8-5. Opening Network Preferences on the Palm



Figure 8-6. Setting up a new network connection on the Palm



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
Options View Log. Scroll to the bottom of the
log, use Graffiti to write ping
hostname and then use the Graffiti stroke
for a carriage return (a diagonal stroke in the ABC region from upper
right to lower left). If you've made the network
connection successfully, you'll be able to ping a
remote host, as shown in Figure 8-7. (Be sure that
the remote host accepts pings and that your network does not block
them).



Figure 8-7. Pinging a remote host from the Palm



8.4.3 Connecting from Pocket PC



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 Connections. The
Connections settings will appear, as shown in Figure 8-8. Click Add a New Modem Connection.




Figure 8-8. Connection settings on the Pocket PC



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.




Figure 8-9. Specifying general settings on the Pocket PC



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.




Figure 8-10. Specifying port settings on the Pocket PC



To connect to the Linux system, align your infrared ports, and then:



Click the Start menu and choose Settings Connections.
Click Manage Existing Connections under the same section where you
created the connection originally.



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.




Figure 8-11. Making the connection on the Pocket PC



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.




Figure 8-12. The Manual Dial Terminal on the Pocket PC



Figure 8-13. Confirming the connection on the Pocket PC



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.


/ 100