Author Topic: Usb Network Problem  (Read 7097 times)

Dromede

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • http://
Usb Network Problem
« on: July 11, 2007, 07:44:45 am »
first of all i'd like to say that i know next to nothing about networking. i have a C1000 runinng pdaxii3 latest. my home lan network is very simple. it consists of only two computers. one of them is running winxp pro sp2 and the other one is running kubuntu feisty. the winxp box has adsl internet access through an usb adsl modem and ICS is turned on so i can access the internet on my kubuntu box. now what i'd like to do is to hook the Z to a kubuntu box and have lan access to my lan network and access to the internet from the Z. here's what i did so far. i put the Z in network usb mode and set it's IP to 192.168.129.201. ifconfig then shows a loopback interface and a usbd0 interface on the Z. kubuntu recognises the Z and  creates a usb0 interface that shows up in ifconfig.  i set usb0 interface IP to 192.168.129.1 and now i can ping my Z and vice versa. what i can't do is ping the winxp box from Z. when i issue the ping command to IP adress 192.168.0.1 (the winxp box) i get "network unreachable". i tried messing with ethernet bridges too. i setup an ethernet bridge on my kubuntu box that bridges the usb0 and eth0 interface but that didn't do anything...so i'm stuck right now. hell, i don't even know what to look for on google... so if anyone has any ideas please tell me.

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Usb Network Problem
« Reply #1 on: July 11, 2007, 05:29:34 pm »
On the linux pc:
enable ip forwarding on the ubuntu box
sysctl -w net.ipv4.ip_forward=1
or
echo 1 > /proc/sys/net/ipv4/ip_forward

You need a dhcp server running on usb0 (not sure if ubuntu does that for you .. on slackware I did something like "dhcpcd usb0" but if you can bing teh ubuntu box I guess you're ok for this)

and you will also most probabbly need masquerading (iptables will help in this) if you want to surf the net.
I actually used source ip postrouting nat to do more or less the same thing
iptables -t nat -A POSTROUTING -j SNAT -o <DEVICE> --to <IP ADDRESS OF LINUX PC>
were <IP ADDRESS OF LINUX PC> is the ip of the nic connected to the windows box with internet access and <DEVICE> is the nic that you use co coonect to the win box (probabbly eth0).

On the Z:
route add default gw <IP ADDRESS OF usb0 device on PC>

Last time I did this on my 5500 was a long time ago ... forgive me if I do not remember all the details.
« Last Edit: July 11, 2007, 05:31:32 pm by louigi600 »
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

Dromede

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • http://
Usb Network Problem
« Reply #2 on: July 12, 2007, 08:42:22 am »
Quote
On the linux pc:
enable ip forwarding on the ubuntu box
sysctl -w net.ipv4.ip_forward=1
or
echo 1 > /proc/sys/net/ipv4/ip_forward

You need a dhcp server running on usb0 (not sure if ubuntu does that for you .. on slackware I did something like "dhcpcd usb0" but if you can bing teh ubuntu box I guess you're ok for this)

and you will also most probabbly need masquerading (iptables will help in this) if you want to surf the net.
I actually used source ip postrouting nat to do more or less the same thing
iptables -t nat -A POSTROUTING -j SNAT -o <DEVICE> --to <IP ADDRESS OF LINUX PC>
were <IP ADDRESS OF LINUX PC> is the ip of the nic connected to the windows box with internet access and <DEVICE> is the nic that you use co coonect to the win box (probabbly eth0).

On the Z:
route add default gw <IP ADDRESS OF usb0 device on PC>

Last time I did this on my 5500 was a long time ago ... forgive me if I do not remember all the details.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=164746\"][{POST_SNAPBACK}][/a][/div]

thanks for your effort luigi. but it didn't work. here's what i did:

- i enabled the ip forwarding as you instructed
- since i can ping the linux box from the Z and vice versa i skipped the dhcpcd usb0 step
- i did the iptables part on the linux box as you instructed me. i did this;
iptables -t nat -A POSTROUTING -j SNAT -o eth0 --to 192.168.0.1 --> default ip adress of the windows box when you turn ICS with dhcp on
- and then i did this on the Z :route add default gw 192.168.129.1 -->ip adress of the usb0 interface on the   linux box
- and then i got nothing. ping still says "network ureachable", no internet, no nothing.
- last i tried dhcpcd usb0 which removed the ip adress from that interface.and still nothing.

i repeat, i know next to nothing about networks&stuff so i didn't understand 90% of the stuff you told me to do. i did know how to apply them though...

Meanie

  • Hero Member
  • *****
  • Posts: 2803
    • View Profile
    • http://www.users.on.net/~hluc/myZaurus/
Usb Network Problem
« Reply #3 on: July 12, 2007, 09:08:39 am »
Quote
Quote
On the linux pc:
enable ip forwarding on the ubuntu box
sysctl -w net.ipv4.ip_forward=1
or
echo 1 > /proc/sys/net/ipv4/ip_forward

You need a dhcp server running on usb0 (not sure if ubuntu does that for you .. on slackware I did something like "dhcpcd usb0" but if you can bing teh ubuntu box I guess you're ok for this)

and you will also most probabbly need masquerading (iptables will help in this) if you want to surf the net.
I actually used source ip postrouting nat to do more or less the same thing
iptables -t nat -A POSTROUTING -j SNAT -o <DEVICE> --to <IP ADDRESS OF LINUX PC>
were <IP ADDRESS OF LINUX PC> is the ip of the nic connected to the windows box with internet access and <DEVICE> is the nic that you use co coonect to the win box (probabbly eth0).

On the Z:
route add default gw <IP ADDRESS OF usb0 device on PC>

Last time I did this on my 5500 was a long time ago ... forgive me if I do not remember all the details.
[div align=\"right\"][a href=\"index.php?act=findpost&pid=164746\"][{POST_SNAPBACK}][/a][/div]

thanks for your effort luigi. but it didn't work. here's what i did:

- i enabled the ip forwarding as you instructed
- since i can ping the linux box from the Z and vice versa i skipped the dhcpcd usb0 step
- i did the iptables part on the linux box as you instructed me. i did this;
iptables -t nat -A POSTROUTING -j SNAT -o eth0 --to 192.168.0.1 --> default ip adress of the windows box when you turn ICS with dhcp on
- and then i did this on the Z :route add default gw 192.168.129.1 -->ip adress of the usb0 interface on the   linux box
- and then i got nothing. ping still says "network ureachable", no internet, no nothing.
- last i tried dhcpcd usb0 which removed the ip adress from that interface.and still nothing.

i repeat, i know next to nothing about networks&stuff so i didn't understand 90% of the stuff you told me to do. i did know how to apply them though...
[div align=\"right\"][a href=\"index.php?act=findpost&pid=164779\"][{POST_SNAPBACK}][/a][/div]

if you know nothing about networking, then why make things so complicated by going from Z to linux box to windows box? why not connect your Z to your windows box?
SL-C3000 - pdaXii13 build5.4.9 (based on pdaXrom beta3) / SL-C3100 - Sharp ROM 1.02 JP (heavily customised)
Netgear MA701 CF, SanDisk ConnectPlus CF, Socket Bluetooth CF, 4GB Kingston CF,  4GB pqi SD, 4GB ChoiceOnly SD, 2GB SanDisk SD USB Plus, 1GB SanDisk USB Plus, 1GB Transcend SD, 2GB SanDisk MicroSD with SD adaptor, Piel Frama Leather Case, GoldX 5-in-1 USB cable, USB hub, USB mouse, USB keyboard, USB ethernet, USB HDD, many other USB accessories...
(Zaurus SL-C3000 owner since March 14. 2005, Zaurus SL-C3100 owner since September 21. 2005)
http://members.iinet.net.au/~wyso/myZaurus - zBook3K

Dromede

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • http://
Usb Network Problem
« Reply #4 on: July 12, 2007, 09:31:14 am »
ehhh... it's not MY windows box. it's my brothers computer...how about a wmvare running winxp? would that help?

something like this maybe?

http://www.venturecake.com/10-minutes-to-r...ubuntu-desktop/
« Last Edit: July 12, 2007, 09:34:39 am by Dromede »

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Usb Network Problem
« Reply #5 on: July 12, 2007, 11:32:12 am »
Well if you insist on routing trough another box  you better supply details of all nics involved (ip , netmask) so that someone can help you ... there is at least 4 involved:
the nic on the win box that connects to your ubuntu box,
the nic on the ubuntu box that connects to the windoes box,
the usbnet nic on the ubuntu box that connects to the Z
and the usbnet on teh Z that connects to ubuntu.
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

Dromede

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • http://
Usb Network Problem
« Reply #6 on: July 12, 2007, 12:18:22 pm »
ok, here goes:
ifoconfig output from the ubuntu box with Z plugged in:

eth0 (linux box to windows)    Link encap:Ethernet  HWaddr 00:69:00:0E:00:58
          inet addr:192.168.0.23  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: 2002:5383:424c:4:269:ff:fe0e:58/64 Scope:Global
          inet6 addr: 2002:4e00:e4b:4:269:ff:fe0e:58/64 Scope:Global
          inet6 addr: fec0::4:269:ff:fe0e:58/64 Scope:Site
          inet6 addr: fe80::269:ff:fe0e:58/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2109179 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1461451 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:2528806638 (2.3 GiB)  TX bytes:306960217 (292.7 MiB)
          Interrupt:18 Base address:0xc000

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:13 errors:0 dropped:0 overruns:0 frame:0
          TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:2320 (2.2 KiB)  TX bytes:2320 (2.2 KiB)

usb0 (linux box to Z)      Link encap:Ethernet  HWaddr 76:CF:F8:D7:F3:AC
          inet6 addr: fe80::74cf:f8ff:fed7:f3ac/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1494  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:5 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:418 (418.0 B)

ifconfig output from Z:


usbd0    Link encap: Ethernet  HWaddr 40:00:01:00:00:01
                inet addr:192.168.129.201 Bcast:192.168.129.255 Mask:255.255.255.0
                UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
                RX packets:6 errors:0 dropped:0 overruns:0 frame:0
                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                collisions:0 txquelen:100
                RX bytes:384 (384.0 B) Tx bytes:0 (0.0 B)

and the loopback interface.

i installed netmask on the ubuntu box and did this:
netmask 192.168.0.1 <-- ip adress of the winbox
and i got this  --> 192.168.0.1/32
then: netmask 192.168.0.23 (ip of the linux box) --> 192.168.0.23/32
and since usb0 interface had no ip assigned i did this:
ifconfig usb0 192.168.129.1 netmask 255.255.255.0
and then i did --> netmask 192.168.129.1 and got this --> 192.168.129.1/32

now... i didn't think that this would be so complicated. i need this because my sd card reader broke down, i lost my 1gb sd card and my second sd card (512mb lexar) wont work in usb storage mode. now im putting stuff on the Z through my cell phone (SE w300i) which is kinda painful since it has a relatively small microsd card(256mb). so first i have to plug the phone to the ubuntu box, put stuff on the phone, unplug phone, then plug the phone to the Z etc...quite painful and time consuming. i thought that this could be a faster and better way...
« Last Edit: July 12, 2007, 12:19:28 pm by Dromede »

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Usb Network Problem
« Reply #7 on: July 12, 2007, 12:43:45 pm »
how are you pinging ubuntu box .... usb net on ubunto has no IP ... maybe ubunto is doing stuff automatically.
show me what "route -n" gives you in the ubuntu and Z boxes.

You do not need netmask bin to do that
"inet addr:192.168.0.23 Bcast:192.168.0.255 Mask:255.255.255.0"
netmask is that "Mask:255.255.255.0"
And you should look at the man page before because it's giving you the netmask of a single addtess not the network.

Your'e not using IPV6 are you ?
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

Dromede

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • http://
Usb Network Problem
« Reply #8 on: July 12, 2007, 12:56:16 pm »
i manually add an ip adress to the usb0 interface on linux box with ifconfig usb0 192.168.129.1 up. then i can ping it.

route -n from ubuntu box:
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.129.0   0.0.0.0         255.255.255.0   U     0      0        0 usb0
192.168.0.0     0.0.0.0            255.255.255.0   U     0      0        0 eth0
169.254.0.0     0.0.0.0            255.255.0.0     U     1000   0        0 eth0
0.0.0.0         192.168.0.1        0.0.0.0         UG    0      0        0 eth0

route -n from Z:
Destination             Gateway           Genmask            Flags     metric        ref        Use  Iface
192.168.129.0       0.0.0.0               255.255.255.0     U              0               0            0     usbd0

it seems that kubuntu uses ipv6 by default. it can be turned off though...

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Usb Network Problem
« Reply #9 on: July 12, 2007, 01:11:13 pm »
The ip_forward stuff should let linux kernel do routing for you...
cat /proc/sys/net/ipv4/ip_forward
should be on ... if not do the echo thing again

no you need a default gateway on the Z
route add default gw 192.168.129.1 usbd0
this tell the Z to use ubuntu as router

Now you should be able to ssh from z to ubunto or vice versa ... and you shouls also be routed to the windows box ...can you ping the windows box from Z now ?
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

Dromede

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • http://
Usb Network Problem
« Reply #10 on: July 12, 2007, 01:23:31 pm »
ahhh finally... i can ping teh windoze box now... thanks luigi. thanks a bunch.
so basically all i need to do is to tell the Z to use the ubuntu box as a router?

but i still have no internet access on the Z...
« Last Edit: July 12, 2007, 01:25:57 pm by Dromede »

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Usb Network Problem
« Reply #11 on: July 12, 2007, 01:43:29 pm »
To get internet to Z ... supposing you have internet on ubunto (via the windows box).
Activate masquerading or the postrouting source nat I suggested earlier.
With masquerading you should be ok and it's easier (ubuntu should have something easy so that you can share internet from the ubuntu box just like you already have on the windows box).

If ubunto does not ... sorry if I cant give you any better help then this because last time I tryed this was a long time go.
This might get you going
iptables -A POSTROUTING -s 192.168.129.0/255.255.255.0 -j MASQUERADE
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

Dromede

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • http://
Usb Network Problem
« Reply #12 on: July 12, 2007, 01:55:41 pm »
when i issue:
iptables -A POSTROUTING -s 192.168.129.0/255.255.255.0 -j MASQUERADE
i get:
iptables: No chain/target/match by that name
then i tried what you said earlier:
iptables -t nat -A POSTROUTING -j SNAT -o eth0 --to 192.168.0.23
and then:
iptables -A POSTROUTING -s 192.168.129.0/255.255.255.0 -j MASQUERADE
and again i get: iptables: No chain/target/match by that name

louigi600

  • Sr. Member
  • ****
  • Posts: 471
    • View Profile
Usb Network Problem
« Reply #13 on: July 12, 2007, 02:21:32 pm »
Avoid using bothe.
Maybe I forgot the -t nat also for the masquerade:
iptables -t nat -A POSTROUTING -s 192.168.129.0/255.255.255.0 -j MASQUERADE

To remove the snat do
iptables -t nat -D POSTROUTING -j SNAT -o eth0 --to 192.168.0.23
Regards
David

SL-c760*  pdaXrom latest
SL-c860    pdaXrom latest ;-)
SL-c1000  pdaXrom Latest
Acer Aspire One running slackware and Clash
Toshiba AC100 running ARMedslack and Clash

*with some hardware problems but good for testing

Dromede

  • Full Member
  • ***
  • Posts: 155
    • View Profile
    • http://
Usb Network Problem
« Reply #14 on: July 12, 2007, 03:36:01 pm »
i restarted both the linux box and the Z and then i did this:

on the kubuntu box:
iptables -t nat -A POSTROUTING -s 192.168.129.0/255.255.255.0 -j MASQUERADE

and on the Z:
route add default gw 192.168.129.1 usbd0

and nothing. i can't even ping the damn winxp box.

i think I should give up on this...
« Last Edit: July 12, 2007, 03:38:18 pm by Dromede »