PdaXrom: Networking with Linux

From OESF

Revision as of 15:28, 1 April 2006 by Armagon (Talk | contribs)
Jump to: navigation, search

This guide discusses how to establish an internet connection over a USB cable (TCP/IP over USB) with a linux PC.


Contents

Before You Begin

You will need

  • A PC running linux with a recent kernel
  • A Zaurus
  • A cable/stand to connect the two

These instructions have been tested with:

  • Kubuntu 5.10 with a 2.6.12-10 kernel, and a Sharp Zaurus SL-C1000 with pdaXrom 1.1.0beta1.
  • If it worked on your machine, add an entry here

Does Your Computer Detect the Zaurus

On your Z, run "USB" (which is found with the "System Tools" applications. Choose the Network radio button, and make sure that the values are the default:

IP: 192.168.129.201
Netmask: 255.255.255.0
Gateway: [empty]
DNS: [empty]

Press OK.

Now, plug your Zaurus into the appropriate cable and into the PC. For a C1000, the cable is a mini USB cable. [I believe that for older models, your put the Z into its cradle and connect that to the PC.]

On your PC, in a terminal, run tail /var/log/messages . You should see something like one of the following:

Output on Kubuntu 5.10 with 2.6.12-10 kernel.

user@desktop:~$ tail /var/log/messages
Mar 22 05:43:13 localhost kernel: [4378213.648000] usbcore: registered new driver usbnet
Mar 22 05:43:13 localhost usb.agent[12069]:      usbnet: loaded successfully

Output on Debian unstable with 2.6.14-2 kernel connecting to OpenZaurus, not pdaXrom'.

user@desktop:~# tail /var/log/messages
Dec 17 17:35:58 localhost kernel: usb 2-2: new full speed USB device using uhci_hcd and address 10
Dec 17 17:35:58 localhost kernel: usb0: register 'zaurus' at usb-0000:00:10.0-2, pseudo-MDLM (BLAN) device, 52:8c:8b:4f:e4:90


The Debian guide says to find that the module was loaded:

user@desktop:~# lsmod | grep zaurus
usbnet                 17064  2 zaurus,cdc_ether

I got no results doing this. However, searching for usbnet gave me this:

blackmore@death:~$ lsmod | grep usbnet
usbnet                 34824  0
usbcore               118396  6 usbnet,usb_storage,usbhid,ehci_hcd,uhci_hcd
mii                     5760  3 usbnet,8139too,8139cp

Setting up the Usb0 Interface

Next, run ifconfig -a. [Note that the "if" in commands like this that start with it, stands for "network InterFace."] You should see an unconfigured usb0 module.

user@desktop:~$ ifconfig -a
... lines removed ...
usb0      Link encap:Ethernet  HWaddr 1E:57:BF:FA:33:4D
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 b)  TX bytes:0 (0.0 b)

If this is the case, you can now establish a connect. On your Linux PC, issue this command:

sudo ifconfig usb0 192.168.129.200 netmask 255.255.255.0 mtu 576 up

Note that this IP ends in 200, while the IP we set on the Zaurus ends in 201.

Now you can run netstat -r to see a routing table.

user@desktop:~$ netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.129.0   *               255.255.255.0   U         0 0          0 usb0
XX.XX.XXX.0     *               255.255.255.0   U         0 0          0 eth0
default         XX.XX.XXX.1     0.0.0.0         UG        0 0          0 eth0

The first line shows the usb0 device. This is a good thing.

If you issue the same command on your Zaurus, you'll get:

# netstat -r
Kernel IP routing table
Destination     Gateway         Genmask         Flags   MSS Window  irtt Iface
192.168.129.0   *               255.255.255.0   U        40 0          0 usbd0

Ping to See Them Communicate

Now we can try pinging the Zaurus from the PC:

user@desktop:~$ ping 192.168.129.201
PING 192.168.129.201 (192.168.129.201) 56(84) bytes of data.
64 bytes from 192.168.129.201: icmp_seq=1 ttl=64 time=3.05 ms
64 bytes from 192.168.129.201: icmp_seq=2 ttl=64 time=1.13 ms
64 bytes from 192.168.129.201: icmp_seq=3 ttl=64 time=1.67 ms
64 bytes from 192.168.129.201: icmp_seq=4 ttl=64 time=2.10 ms
64 bytes from 192.168.129.201: icmp_seq=5 ttl=64 time=1.26 ms
64 bytes from 192.168.129.201: icmp_seq=6 ttl=64 time=1.04 ms

--- 192.168.129.201 ping statistics ---
6 packets transmitted, 6 received, 0% packet loss, time 5025ms
rtt min/avg/max/mdev = 1.041/1.710/3.054/0.702 ms

You should get similar results by running ping 192.168.129.200 on your Zaurus.

Make The Connection Permanent

The next steps discuss how to make this connection permanent. Until this page is finished, please see the link below.

Now What

Setting a Root Password

Many of the really cool things we want to do require that you set a password on your Zaurus. If you don't, you can not log in remotely.

Open a console on your Z and run

passwd

You'll be asked for a password, and to confirm it. Remember this password, though, for you'll need it the next time you reboot your Z!

Secure Shell

The Secure Shell is like telnet, but safer. It lets you have remotely log in to a computer, and run command line programs.

From the PC to the Z

If your Z has a root password (see above), you can issue this command on your PC: ssh root@192.168.129.201

Now you are logged in remotely and can do anything you want from the command line.

From the Z to the PC

To go the other way, on your Z, issue this command: ssh username@192.168.129.200 where username is your login ID. Also note that you have to have an SSH server running on your PC.

Secure FTP

Secure FTP is FTP over ssh. The commands are exactly the same as above, but you use sftp in place of ssh.

Graphical SFTP

Now here's a nice way to transfer files, if you are running KDE on your desktop. (I'm using KDE 3.5.1, BTW, but I expect it works in earlier versions.) Run konqueror. If you wish, you can go to Network Folders and Add a Network Folder, or you can just type in fish://root@192.168.129.201 into the location bar. It asks for your password, and then you can use it like any other konqueror window. How slick is that?



See Also

Up to pdaXrom main page.

Personal tools