When doing Openmoko hacking, one always first plugged in the USB cable and forwarded network, or like I did later forwarded network over Bluetooth. It was mostly because the WiFi was quite unstable with many of the kernels.
I recently found out myself using a chroot on a Nexus 4 without working WiFi, so instead of my usual WiFi usage I needed network over USB... trivial, of course, except that there's Android on the way and I'm a Android newbie. Thanks to ZDmitry on Freenode, I got the bits for the Android part so I got it working.
On device, have eg. data/usb.sh with the following contents.
On the host, execute the following:#!/system/xbin/sh CHROOT="/data/chroot" ip addr add 192.168.137.2/30 dev usb0 ip link set usb0 up ip route delete default ip route add default via 192.168.137.1; setprop net.dns1 22.214.171.124 echo 'nameserver 126.96.36.199' >> $CHROOT/run/resolvconf/resolv.conf
This works at least with Ubuntu saucy chroot. The main difference in some other distro might be whether the resolv.conf has moved to /run or not. You should be now all set up to browse / apt-get stuff from the device again.adb shell setprop sys.usb.config rndis,adb adb shell data/usb.sh sudo ifconfig usb0 192.168.137.1 sudo iptables -A POSTROUTING -t nat -j MASQUERADE -s 192.168.137.0/24 echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward sudo iptables -P FORWARD ACCEPT
Update: Clarified that this is to forward the desktop/laptop's network connection to the device so that network is accessible from the device over USB.
Update2, 09/2013: It's also possible to get working on the newer flipped images. Remove the "$CHROOT" from nameserver echoing and it should be fine. With small testing it got somehow reset after a while at which point another run of data/usb.sh on the device restored connection.