Author Topic: Usb Networking  (Read 10588 times)

scottlfa

  • Sr. Member
  • ****
  • Posts: 281
    • View Profile
    • http://
Usb Networking
« on: November 08, 2007, 01:52:30 am »
Between a Z and a Linux host.

usb-gadget start

The first step would be to configure the device usb0 in /etc/network/interfaces on your Z.

# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet static
        address 192.168.129.10
        netmask 255.255.255.0
        network 192.168.129.0
        gateway 192.168.129.1

usb-gadget already pre-configures usb0 for you, so you can just use the defaults here.

The next step is to configure usb0 on your PC. Again, this is done in /etc/network/interfaces:

iface usb0 inet static
     address 192.168.129.1
     pointopoint 192.168.129.10
     netmask 255.255.255.0
     network 192.168.129.0
     broadcast 192.168.129.255

The IP of your Zaurus has been set to 192.168.129.10, the IP of your PC (for the USB network only!) has been set to 192.168.129.1.

Run ifup usb0 on both your Zaurus and the PC to bring up the devices.
At this point your Zaurus should be able to ping your PC:

# ping 192.168.129.1
PING 192.168.129.1 (192.168.129.1): 56 data bytes
64 bytes from 192.168.129.1: icmp_seq=0 ttl=64 time=1.3 ms
64 bytes from 192.168.129.1: icmp_seq=1 ttl=64 time=4.1 ms

To allow your Z to connect to the other machines in your local network (LAN), you have to enable IP forwarding on the machine connected to your Z:

echo 1 > /proc/sys/net/ipv4/ip_forward

and use NAT on outgoing connections:

iptables -t nat -A POSTROUTING -s 192.168.129.0/24 -j MASQUERADE
"So there I was, spitting on my goldfish trying to keep it alive ..."
---------------------------------------------------------------< O >-------------------------------------------------------
Viliv N5 [Debian]
Acer One Running OSX 10.5.7 [Dell 3190 & Ram Upgraded]
SL-C1000 [ZUbuntu], JasJar [WM 6.5], Nokia N900, and Samsung Galaxy S 4G.
Sony Ux280P [Kbuntu 10.4 Lucid], PsP Go and DSi

dlj0

  • Full Member
  • ***
  • Posts: 218
    • View Profile
Usb Networking
« Reply #1 on: November 29, 2007, 11:26:56 am »
Quote from: scottlfa
Between a Z and a Linux host.

Excellent!  I hadn't been able to get anywhere with usb networking before.  Now, it works fine.  Very nice.
Zaurus:  SL C3100
ROM:  eabi debian/sid

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Usb Networking
« Reply #2 on: November 30, 2007, 03:03:17 pm »
That's an essential tip. Wikify it?

Life is too precious for hacking *too much*
Visit my Z screencap gallery[/color]
My EeePC 701 Black = Debian (Lenny) on IceRocks + Transcend SDHC Class6 8GB + 2GB RAM
My Zaurus SL-C3200 = Debian EABI (kernel 2.6.24.3-yonggun) on a swapped internal Sandisk Extreme III CF 16gb
My Debian EABI feed: http://matrixmen.free.fr/zaurus/debian/
My OpenBSD/Zaurus feeds:  Link1, Link2
[/i][/font][/color][/size]

axeTail

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Usb Networking
« Reply #3 on: April 14, 2008, 06:42:17 am »
Quote from: ZDevil
That's an essential tip. Wikify it?

Hi where can I enter my proxy settings? Thanks

axeTail

  • Jr. Member
  • **
  • Posts: 75
    • View Profile
Usb Networking
« Reply #4 on: April 14, 2008, 04:11:12 pm »
Quote from: scottlfa
Between a Z and a Linux host.

usb-gadget start

The first step would be to configure the device usb0 in /etc/network/interfaces on your Z.

# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet static
        address 192.168.129.10
        netmask 255.255.255.0
        network 192.168.129.0
        gateway 192.168.129.1

usb-gadget already pre-configures usb0 for you, so you can just use the defaults here.

The next step is to configure usb0 on your PC. Again, this is done in /etc/network/interfaces:

iface usb0 inet static
     address 192.168.129.1
     pointopoint 192.168.129.10
     netmask 255.255.255.0
     network 192.168.129.0
     broadcast 192.168.129.255

The IP of your Zaurus has been set to 192.168.129.10, the IP of your PC (for the USB network only!) has been set to 192.168.129.1.

Run ifup usb0 on both your Zaurus and the PC to bring up the devices.
At this point your Zaurus should be able to ping your PC:

# ping 192.168.129.1
PING 192.168.129.1 (192.168.129.1): 56 data bytes
64 bytes from 192.168.129.1: icmp_seq=0 ttl=64 time=1.3 ms
64 bytes from 192.168.129.1: icmp_seq=1 ttl=64 time=4.1 ms

To allow your Z to connect to the other machines in your local network (LAN), you have to enable IP forwarding on the machine connected to your Z:

echo 1 > /proc/sys/net/ipv4/ip_forward

and use NAT on outgoing connections:

iptables -t nat -A POSTROUTING -s 192.168.129.0/24 -j MASQUERADE


Hi All,

I can ping my z and my pc. When I try to ping www.google.com (for example), it says unknown host. What am I missing? Please help. I followed the instructions.

ZDevil

  • Hero Member
  • *****
  • Posts: 1998
    • View Profile
    • http://
Usb Networking
« Reply #5 on: April 15, 2008, 09:32:48 am »
Set DNS nameserver?

Life is too precious for hacking *too much*
Visit my Z screencap gallery[/color]
My EeePC 701 Black = Debian (Lenny) on IceRocks + Transcend SDHC Class6 8GB + 2GB RAM
My Zaurus SL-C3200 = Debian EABI (kernel 2.6.24.3-yonggun) on a swapped internal Sandisk Extreme III CF 16gb
My Debian EABI feed: http://matrixmen.free.fr/zaurus/debian/
My OpenBSD/Zaurus feeds:  Link1, Link2
[/i][/font][/color][/size]

mars

  • Full Member
  • ***
  • Posts: 145
    • View Profile
Usb Networking
« Reply #6 on: June 10, 2008, 01:38:45 am »
Quote from: ZDevil
Set DNS nameserver?

The below more detailed answer is partly to help me remember next time I forget.

The DNS (nameserver) is called out in /etc/resolv.conf -- Therefore find/google the nameserver for your internet provider, and edit /etc/resolv.conf to match:

nameserver 64.169.140.6

or whatever your nameserver is.

While I'm at it, if you use ubuntu, "sudo echo 1 > /proc/sys/net/ipv4/ip_forward" doesn't seem to work due to permission issues. Instead do a "sudo -i" and then do the echo 1 command from the resulting root prompt.

Oh, I also notice that I need to turn off the firewall on the PC (firestarter) for the usb networking to work. I am not smart enough yet to get it to work with the firewall running.

-- mars
C-3100 (reaquainting myself with Cacko) / Nokia 810 / Nokia N800 / Asus eeePC
Previously owned: SL-5500 / SL-5600 / SL-6000L / C-860 / Nokia 770 / Pepperpad 3

Osage

  • Newbie
  • *
  • Posts: 11
    • View Profile
Usb Networking
« Reply #7 on: June 22, 2008, 06:09:56 am »
Quote from: scottlfa
Between a Z and a Linux host.

usb-gadget start

The first step would be to configure the device usb0 in /etc/network/interfaces on your Z.

# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
iface usb0 inet static
        address 192.168.129.10
        netmask 255.255.255.0
        network 192.168.129.0
        gateway 192.168.129.1

usb-gadget already pre-configures usb0 for you, so you can just use the defaults here.

The next step is to configure usb0 on your PC. Again, this is done in /etc/network/interfaces:
[...]

This is what doesn't work for me.
On Z I can set up usb0 easily, but not on my laptop PC.
I've tried g_ether, cdc_*, usbnet, zaurus modules so far.

laptop#: modprobe g_ether host_addr=00:dc:c8:f7:75:05 dev_addr=7e:44:7c:4f:a0:6c
FATAL: Error inserting g_ether (/lib/modules/2.6.24.2v2/kernel/drivers/usb/gadget/g_ether.ko): No such device

What should I do?

ShiroiKuma

  • Hero Member
  • *****
  • Posts: 900
    • View Profile
Usb Networking
« Reply #8 on: February 25, 2009, 01:14:24 pm »
I'm using USB networking on the HTC Universal in this way, all's fine.

How do you access the other devices filesystem over USB? Is it possible? Or you can SSH into the other one? Haven't done that before, anyone have some pointers?
[span style=\'font-size:8pt;line-height:100%\']Das ganze tschechische Volk ist eine Simulantenbande.[/font][/span]
Militäroberarzt Bautze

scottlfa

  • Sr. Member
  • ****
  • Posts: 281
    • View Profile
    • http://
Usb Networking
« Reply #9 on: March 30, 2009, 01:55:49 pm »
Been getting more and more interested in try Debian on my extra universal.  Hows it run?
"So there I was, spitting on my goldfish trying to keep it alive ..."
---------------------------------------------------------------< O >-------------------------------------------------------
Viliv N5 [Debian]
Acer One Running OSX 10.5.7 [Dell 3190 & Ram Upgraded]
SL-C1000 [ZUbuntu], JasJar [WM 6.5], Nokia N900, and Samsung Galaxy S 4G.
Sony Ux280P [Kbuntu 10.4 Lucid], PsP Go and DSi

axellira

  • Newbie
  • *
  • Posts: 6
    • View Profile
Usb Networking
« Reply #10 on: June 21, 2009, 04:49:16 am »
Thanks . Did someone put it on the wiki already?