Help - Search - Members - Calendar
Full Version: Usb Network Problem
OESF Forums > Distros, Development, and Model Specific Forums > Distro Support and Discussion > pdaXrom
Dromede
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. unsure.gif
louigi600
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.
Dromede
QUOTE(louigi600 @ Jul 11 2007, 10:29 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.
*


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
QUOTE(Dromede @ Jul 12 2007, 10:42 PM)
QUOTE(louigi600 @ Jul 11 2007, 10:29 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.
*


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...
*



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?
Dromede
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/
louigi600
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.
Dromede
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...
louigi600
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 ?
Dromede
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
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 ?
Dromede
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...
louigi600
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
Dromede
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
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
Dromede
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...
louigi600
QUOTE
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.
Dromede
QUOTE(louigi600 @ Jul 12 2007, 08:52 PM)
QUOTE
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.

*



that's the first thing i always do. sorry for not mentioning it in my last post... sad.gif

i can ping the usb0 interface on the kububox but not the winxp box. and no internet of course.
louigi600
Go trough all the thread again because at some point you had it working (without internet),
and for what you need to do maybe internet is not that important.
Meanie
QUOTE(louigi600 @ Jul 13 2007, 04:40 PM)
Go trough all the thread again because at some point you had it working (without internet),
and for what you need to do maybe internet is not that important.
*


yeah, go back to where you could ping your windows box from your Z. that's when your network was set up correctly except you had no DNS on your Z and thus could not access internet. just add the DNS entry from your windows box into /etc/resolv.conf
louigi600
QUOTE(Meanie @ Jul 13 2007, 09:02 AM)
QUOTE(louigi600 @ Jul 13 2007, 04:40 PM)
Go trough all the thread again because at some point you had it working (without internet),
and for what you need to do maybe internet is not that important.
*


yeah, go back to where you could ping your windows box from your Z. that's when your network was set up correctly except you had no DNS on your Z and thus could not access internet. just add the DNS entry from your windows box into /etc/resolv.conf
*


If dhcp server is configured correctly it should distribute also the DNS ... not sure what happens with ubuntu since it's doing most of the work automatically.
Dromede
w00t, w00t it works!!! i can ping'em all and i have internet access. meanie struck the final blow to my problem, all i had to do for internet access was to add the appropriate ip adress to the resolv.conf file. thank you meanie, thank you very much. and thank you luigi for you effort and patience.maybe i should add this to the wiki...
Dromede
QUOTE(Dromede @ Jul 13 2007, 01:34 PM)
w00t, w00t it works!!! i can ping'em all and i have internet access. meanie struck the final blow to my problem, all i had to do for internet access was to add the appropriate ip adress to the resolv.conf file. thank you meanie, thank you very much. and thank you luigi for you effort and patience.maybe i should add this to the wiki...
*


hehheheh...my first post written and submitted from the Z... :-D

but damn...dilllo has some weird formatting.i will try firefox...
alijames
QUOTE
hehheheh...my first post written and submitted from the Z... :-D

Nice One! This one written on mine sitting on a deckchair, on the roof, in Oxford, with the sun trying vainly to come out...

QUOTE
but damn...dilllo has some weird formatting.i will try firefox...
*

Have fun waiting for it to load up...

Alistair
Dromede
yeah well...nothing i can do about it. god i miss Opera on pdaxii3...
T3_slider
QUOTE(Alistair)
Have fun waiting for it to load up...

Man, everyone is either very impatient or exaggerates the problem greatly. Yes it takes a little while to load (I just timed it and it took 1 minute and 5 seconds immediately following a suspend with gtkterm2 open), but once up and running it is quite usable (I'm used to a PC with a 333 MHz processor [until I get the remaining parts to build my new PC which should be very soon], so I guess I've been forced to be a little patient, but it's quite usable to me.) Dillo is unusable to me -- it renders pages so badly that it detracts from its use. I prefer links to Dillo for some reason, and I'd much rather use firefox than either.

I usually have a firefox window open permanently anyway (unless I need the extra RAM for something else), so its load time is nill (I usually suspend with a terminal [gtkterm2] and a firefox window open and all remains fine after resuming). I guess one minutes just isn't the end of the world to me. If I'm just using my Z to check one very quick thing and then turning it back off, sure, I'll use links, but for any extended period of browsing I'd much rather use firefox.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.