Ethernet over USB

From Qi-Hardware
Revision as of 05:58, 26 March 2010 by Wolfgang Spraul (Talk | contribs)
Jump to: navigation, search

The recent uboot/kernel images have Ethernet-over-USB support enabled per default, which you can use to give the NanoNote a network connection.

Setup

On the NanoNote run (for example):

$ ifconfig usb0 192.168.3.2

On your laptop/PC run:

$ lsusb
Bus 001 Device 006: ID 0525:a4a2 Netchip Technology, Inc. Linux-USB Ethernet/RNDIS Gadget
$ ifconfig usb0 192.168.3.1
$ ifconfig
usb0      Link encap:Ethernet  HWaddr 16:90:89:ea:82:6f  
          inet addr:192.168.3.2  Bcast:192.168.3.255  Mask:255.255.255.0
          inet6 addr: fe80::1490:89ff:feea:826f/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

You can then ping the laptop from the Nanonote via:

$ ping 192.168.3.2


NAT config

(thanks to David Reyes Samblas Martinez) then on Ben: give a password to root be able to ssh to it

   $ passwd

now you can follow this instructions on a ssh console to Ben on host on Ben:

   $ route add default gw 192.168.3.1
   $ echo "nameserver (ip of a DNS server here)" >> /etc/resolv.conf

I use an internal DNS server 192.168.2.1 but you can use any DNS server

on Host as root:

  # modprobe iptable_nat
  # echo "1" > /proc/sys/net/ipv4/ip_forward
  # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE


and "voilà"! your Ben conected to the outside world

Personal tools
Namespaces
Variants
Actions
Navigation
interactive
Toolbox
Print/export