Author Topic: Connecting to the outside world  (Read 3808 times)

beak

  • Newbie
  • *
  • Posts: 8
    • View Profile
Connecting to the outside world
« on: June 06, 2004, 02:12:59 pm »
Hello again,

By the time that all of my questions have been answered, I\'ll be able to write a book on them .

Having sucessfully connected the Zaurus to my computer and vise versa, I\'d like to be able to connect the Zaurus to the outside world. I\'ve got the general idea, but actually implementing that idea isn\'t very easy.

Here\'s my setup: My internet connection is cable, which connects into eth0 (IP Dynamic) of my router. The router then connects eth1 (192.168.1.254) to a switch. My computer is connected to the switch via (its) eth0 (192.168.1.2). The zaurus is connected via a USB (TCP/IP) connection, usbd0 (192.168.3.1), to my computer, usb0 (192.168.3.2).

How do I make the Zaurus able to browse the \'net?

Stubear

  • Hero Member
  • *****
  • Posts: 1164
    • View Profile
    • http://
Connecting to the outside world
« Reply #1 on: June 06, 2004, 08:07:56 pm »
You need to set up ip masquerading on the desktop - I think windows calls it \"internet sharing\" but I could be wrong

You will also need to tell the zaurus that 192.168.3.2 is the default route - route add default gw 192.168.3.2 usbd0

Stu
SL-C1000, Hand converted to English with Japanese Input
Running X apps via X/Qt
iRiver USB host cable; Diatec P-Cord usb power cable (extendable); Acro's Reel Cable USB (A to A, B, Mini-B,  & Mini-B 8pin); GreenHouse 1Gb PicoDrive+; 2x256Mb Hagiwara SD cards; 128Mb Transcend CF card; 512Mb PQI CF card; AmbiCom WL1100C-CF 11B WLAN card

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
Connecting to the outside world
« Reply #2 on: June 07, 2004, 01:02:13 am »
in the linux desktop which will do the ipmasquerading, create /etc/sysconfig/network-scripts/ifcfg-usb0 with:

BOOTPROTO=static
BROADCAST=192.168.129.255
IPADDR=192.168.129.1
NETMASK=255.255.255.0
NETWORK=192.168.129.0
DEVICE=usb0


Got this snippet of code from a firewall script and modified it to do ipmasq for usb0 interface on the linux desktop:

#!/bin/sh
echo 1 ] /proc/sys/net/ipv4/ip_forward
 
IPTABLES=/sbin/iptables
INTIF=usb0
EXTIF=eth0
echo \"   Clearing any existing rules and setting default policy..\"
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD
$IPTABLES -t nat -F
 
echo \"   FWD: Allow all connections OUT and only existing and related ones IN\"
$IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
$IPTABLES -A FORWARD -j LOG
 
echo \"   Enabling SNAT (MASQUERADE) functionality on $EXTIF\"
$IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE



The corresponding command on the zaurus is:


#!/bin/sh
IPTABLES=/usr/local/sbin/iptables

 
 
route add -host 192.168.129.1 usbd0
route delete -net 192.168.129.0/24 usbd0
route add default gw 192.168.129.1
 
 
 
echo \"   Clearing any existing rules and setting default policy..\"
$IPTABLES -P INPUT ACCEPT
$IPTABLES -F INPUT
$IPTABLES -P OUTPUT ACCEPT
$IPTABLES -F OUTPUT
$IPTABLES -P FORWARD DROP
$IPTABLES -F FORWARD



I am still playing around with the script.  I dont understand iptables all that well but it seems to work.  Use at your own risk.  Maybe others can comment on what the script is doing.  I would like to automate ntpdate with this, that is, everytime I put the z on the cradle, it would sync the date with an internet time server.  I find that I have to put the masq script in the zaurus in /etc/hotplug/net.agent to automate the zaurus script.  I have not found a way to automate it using hotplug on the desktop though.
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

cmisip

  • Sr. Member
  • ****
  • Posts: 256
    • View Profile
    • http://home.mchsi.com/~cmisip/index.htm
Connecting to the outside world
« Reply #3 on: June 07, 2004, 01:20:06 am »
It seems even with usb0 down in the linux desktop, the script will still work.  So I will put in in /etc/rc.d/rc.local

Will keep testing
Zaurus 5600
Zynergy Rootfs 1.1
Custom zImage

How Do You Do That in Linux

beak

  • Newbie
  • *
  • Posts: 8
    • View Profile
Connecting to the outside world
« Reply #4 on: June 08, 2004, 08:15:36 pm »
You\'d you have thunk it, I got everything that I wanted to do with this thing (except one) working, which included connecting to a generic 2.6 kernel computer via the docking station, connecting to the outside world via IP Masquerading, and hotplugging (under Slackware, at least).

They\'re all relatively simple answers; I\'ll post a complete HOW-TO as soon as school\'s out (junior going on senior in high school...).

There\'s only one more quesiton that I\'ve got (at the moment; I\'m sure that there will be more questions later). On the docking station, there\'s this one large goofy button that is apparently a sync button. Now... how can I utilize this under Linux?

Beak