Networked Neos
If you want to reliable connect onย Ubuntu mobile operating system toย the neo or even to connect more than one neo at a time and access all seemlessly this desciption is made for you.
The idea is to have a mapping neo => mac-adress => host-network-interface-name => ip-number => name . To acieve this several steps must be taken.
Be aware that you need a pair of ip-numbers per neo if you want to connect more than one. One for the host, one for the neo.
Give the neos macs
Make sure each neo has its own mac for its usb-ether device. This is already the fact but the mac is generated by random for the usb-ether and must be persistet somehow to have the same mac each time you reboot the neo. The gta02 supports that with Qi automatically through the identity partition, the gta01 needs a kernel option which can simply be added to the file
/boot/append-GTA01
on the neo/sd (if booted from sd via Qi) like:
g_ether.host_addr=00:00:00:00:00:00
replace the 00:00… with a valid random mac. just use the mac that is set by random after first boot which is shown with the
ifconfig -a
command on the host.
Map macs to different interface names
In the file
/etc/udev/rules.d/70-persistent-net.rules
on the host add a line per neo you own like this (again: replace the mac with yours as mentioned above):
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:00", NAME="gta01"
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="00:00:00:00:00:00", NAME="gta02"
Reload that config with
/etc/init.d/udev reload
on the host.
Name you neos
Giving your neo the right hostname is easy, just write the name into the file
/etc/hostname
. The name will be used after the next reboot.
Name you neos by ip-number
In order to allow names instead of long ips, enhance your
/etc/hosts
on the host & the neos with two lines per neo like:
192.168.0.199 host01
192.168.0.200 host02
192.168.0.198 host03
192.168.0.197 host04
192.168.0.201 gta01
192.168.0.202 gta02
192.168.0.203 protector
192.168.0.204 ben
Note: I use 201 and above for the noes and 200 and below for the hosts ips.
Note: SSH does reverse lookups of IPs that try to login. This setting will also speedup this
Note: Because we use host-netmasks later this setup works even if your home network is 192.168.0.0 – as long as you do not use hosts with the ip-numbers as used for the neos in that network.
Tell the system how to configure the interfaces
In the file
/etc/network/interfaces
on the host networking is configured. The following block enables to configure the interface as we want when plugged in:
allow-hotplug gta02
iface gta02 inet static
address host02
netmask 255.255.255.255
post-up route add gta02 gta02
post-up echo 1 > /proc/sys/net/ipv4/ip_forward
post-up iptables -t nat -A POSTROUTING -j MASQUERADE
post-down iptables -t nat -D POSTROUTING -j MASQUERADE
post-down echo 0 > /proc/sys/net/ipv4/ip_forward
Restart networking with
/etc/init.d/networking restart
.
Tell the neos their IP
If you intend to use more than on neo, each has its own ip number. The default network configuration is to use the .202. The file
/etc/network/interfaces
on the neo must be changed to reflect the new numbers:
address gta02
Use the names of the neos you defined in the
/etc/hosts
before.
If you now plugin your neo, everything should be configured as desired.
Note: There is one probably unwanted effect: if you have ip-forwarding already enabled or have plugged in more than one neo the forwarding is switched off with the first neo that is disconnected. If you don’t like that behavior and would prefere to have forwarding kept on even if all neos were removed just dont add the last line of the networking configuration.