Ethernet over USB
The recently uboot/kernel images have Ethernet-over-USB support enabled by default, which you can use to give the NanoNote a connection to the internet.
Contents |
Setup on the host
To let your NanoNote use your laptops/PCs (host) internet connection, you have to enable NAT and routing on your host and set a default route on your NanoNote via your host.
The NanoNote's IP address is set to 192.168.254.101 by default.
Note - if you use Ubuntu, consider removing the default connection-manager, and replacing it with wicd. The connection manager has issues with adding & removing networking hardware, while wicd ignores usb0.
Network config
On your linux/unix host run:
$ ifconfig usb0 192.168.254.100
to give your host an IP address which is in the same subnet as your NanoNote.
To review that, you can use ifconfig as well
$ ifconfig usb0
and should get the following
usb0 Link encap:Ethernet HWaddr 16:90:89:ea:82:6f
inet addr:192.168.254.100 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)
To verify the proper connection, you can try to ping your NanoNote from your host and vice versa (note: NanoNote has the 101 in the end).
$ ping 192.168.254.101 # pinging your NanoNote from your host
Now we have successfully established a network connection between host and NanoNote.
To let your NanoNote use your hosts internet connection, we have to enable routing and NATting on the hosts side:
NAT config
# modprobe iptable_nat # echo "1" > /proc/sys/net/ipv4/ip_forward # iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE # eth0 in this example is the interface on your host connected to the internet, adjust if needed
Setup on the NanoNote
Network config
Login into your NanoNote, either with:
$ telnet 192.168.254.101
or - if you already set a root password on your NanoNote - with:
$ ssh root@192.168.254.101
$ route add default gw 192.168.254.100 # set a route on your NanoNote through your host $ echo "nameserver 8.8.8.8" >> /etc/resolv.conf
In this example we use googles nameserver (8.8.8.8) but you can use any you'd like.
We're done now! :)
You may want to verify your setup by connecting an outer server by your NanoNote with pinging e.g. google.com:
$ ping google.com
You should see sth. like:
PING google.com (209.85.129.105) 56(84) bytes of data. 64 bytes from fk-in-f105.1e100.net (209.85.129.105): icmp_seq=1 ttl=57 time=44.2 ms 64 bytes from fk-in-f105.1e100.net (209.85.129.105): icmp_seq=2 ttl=57 time=44.1 ms
and "voilà"! your Ben is now conected to the evil internet :)
Transfer files
$ scp PC_FILE root@192.168.254.101:~/ $ scp root@192.168.254.101:/PATH/TO/NANONOTE_FILE ./
use sshfs, like mount a disk to your pc.
$ sudo sshfs root@192.168.254.101:/ /mnt
Making it persistent
There is more than one way to do this. This is one way.
On your host PC
Note that this is written for Debian-based systems. Some things might be slightly different on other systems.
sudoedit /etc/sysctl.conf
..and make it look more like this:
# Uncomment the next line to enable packet forwarding for IPv4 net.ipv4.ip_forward=1
..then:
sudoedit /etc/rc.local
..and make it look more like this:
iptables -t nat -A POSTROUTING -j MASQUERADE exit 0
..then:
sudo su -
cat <<EOF >/etc/udev/rules.d/z49_my.rules
SYSFS{idVendor}=="0525", SYSFS{idProduct}=="a4a2", GROUP="plugdev", RUN="/root/bin/nanonote-plugged-in"
EOF
cat <<EOF > /root/bin/nanonote-plugged-in
#!/bin/sh -e
ifconfig usb0 192.168.254.100 up
EOF
chmod +x /root/bin/nanonote-plugged-in
exit
On the NanoNote
rm /etc/resolv.conf echo "nameserver 8.8.8.8" > /etc/resolv.conf $EDITOR /etc/rc.local
..and make it look more like this:
ifconfig usb0 192.168.254.101 up route add default gw 192.168.254.100 exit 0
..where:
- $EDITOR is your favorite editor
- 192.168.254.101 is the IP address+ that you chose for your NanoNote
- 192.168.254.100 is the IP address+ that you chose for the usb0 interface on your host PC
+ on the 192.168.254.0/24 network