openmoko: change usbnet ethernet address

I got the openmoko P1 phone that i ordered right after I got back from my trip, but i didn’t get much of a chance to play with it until tonight. The first step after flashing a newer image is to get usbnet up and running, so that I can control the phone from my computer and copy stuff too and from it. This is surprisingly simple to accomplish; there are good directions at a few sites:

http://wiki.openmoko.org/wiki/USB_Networking
http://www.handhelds.org/moin/moin.cgi/UsbNet

However, I ran into a problem because the default Ethernet subnet that the phone uses is 192.168.0.x, which conflicts with my (unfortunately) hardwired router. So, I decided to use 192.168.1.x for the phone interface. First, the pc address needs to be changed to 192.168.1.200 in the preceding instructions, then the usb0 interface on the neo needs to be changed to the new address:

ifconfig eth0 192.168.1.202

then ssh should work (could test the connection using ping if this is desired). Once into the phone, the address can be changed permanently (at least until the device is flashed again) by modifying the /etc/network/interfaces file.

note: (added 8/28/07)
on a more recent build, the usbnet module was not added at boot (saywha???), so it needs to be loaded first to get the interface up. Then, the interface is named usb0 (as it probably should be), so that is the one that needs to be assigned the new ip address:

modprobe usbnet
ifconfig usb0 192.168.1.202

and to add the module at startup:

 echo "usbnet" > /etc/modutils/usbnet 

note: (added 8/24/07)
To set up masquerading so that the neo can also talk to the outside world, the host has to have a masquerade link set up as well:

iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.0.0/24
echo 1 > /proc/sys/net/ipv4/ip_forward
iptables -P FORWARD ACCEPT

directions are from here:

http://blog.haerwu.biz/2007/03/22/hotpluging-usbnet/

and an appropriate /etc/resolv.conf should be set up on the neo (or perhaps the usb0 rule should be changed to automatically add the nameserver?). One way to do this is (with a nameserver at 192.168.0.1):

cat "nameserver 192.168.0.1" > /etc/resolv.conf 
This entry was posted in tech. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>