Ethernet over USB/zh-hans

From Qi-Hardware
Jump to: navigation, search

最近的 镜像 已经默认打开了usb以太网的支持。 通过它可以使NanoNote访问Internet。

[edit] Setup

例如, 在NanoNote上运行

$ ifconfig usb0 192.168.3.2

在你的笔记本/PC上运行:

$ 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.1  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)

这样你就可以通过下面的地址访问到NanoNote了

$ ping 192.168.3.2

[edit] NAT 配置

(感谢 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