Debian (USB)

From OESF

Revision as of 15:17, 21 October 2009 by Jidanni (Talk | contribs)
(diff) ←Older revision | Current revision (diff) | Newer revision→ (diff)
Jump to: navigation, search

Howto setup network conectivity with the Zaurus under Debian.

Kernel setup

Here are simple steps to make a Debian package of the usb modules for your kernel. If they are confusing or does not work follow the generic Linux (USB) howto for setting up the kernel which does the same thing.

1) determine running kernel version. (i.e. 2.4.19-k7)
2) use apt or dpkg to install kernel-source-[[version] (i.e. 2.4.19)
3) apt-get install kernel-package fakeroot
4) cd /usr/src; tar jxvf kernel-source-[[version].tar.bz2 (i.e. 2.4.19)
5) cd /usr/src/kernel-source-[[version]
6) cp /boot/config-[[version] .config
7) make menuconfig, disable CDCEther, enable USBDnet and configure per the steps in the the general linux howto.

note: one caviat. In addition to the configuration you enter for the vendor and product ids per the howto, in order to ensure hotplugging works properly, you need to set "usbd network class" to 2.

8) dpkg -s kernel-image-[[version] - check Version line (i.e. 2.4.19-1) 9) fakeroot make-kpkg --bzimage --arch-in-name --revision [[Version from step 5] kernel_image; 10) sudo dpkg -i ../kernel-image-[[version]*.deb

Network Configuration

In the file: /etc/network/interfaces

To use the dhcp server on the Zaurus add:

iface usb0 inet dhcp

For a static IP address add:

iface usb0 inet static
address 192.168.129.1
pointopoint 192.168.129.201
netmask 255.255.255.255

Hot Plug

You only have to install "hotplug", which will automaticly configure USB devices assuming that the modules are working. Hotplug will set up the usb0 device everytime you insert the Zaurus in the cradle according to how it is setup in section 2.

This goes in /etc/network/if-up.d/50zaurus. It must be executable. It allows your Z to get out on the internet using IP masquerading through your debian box. Note that you need to have masquerading already in your kernel. See the general howto for more information about that. The script:

#!/bin/sh
 case $IFACE in
  usb0)
   echo 1 > /proc/sys/net/ipv4/ip_forward
   iptables -t filter -F FORWARD
   iptables -t filter -P FORWARD DROP
   iptables -t filter -A FORWARD -s $IF_POINTOPOINT/$IF_NETMASK -j ACCEPT
   iptables -t filter -A FORWARD -d $IF_POINTOPOINT/$IF_NETMASK -j ACCEPT
   iptables -t nat -F PREROUTING
   iptables -t nat -P PREROUTING ACCEPT
   iptables -t nat -F POSTROUTING
   iptables -t nat -P POSTROUTING ACCEPT
   iptables -t nat -F OUTPUT
   iptables -t nat -P OUTPUT ACCEPT
   iptables -t nat -A POSTROUTING -s $IF_POINTOPOINT/$IF_NETMASK -o eth0 -j MASQUERADE
   ;;
esac
Personal tools