can one do opkg operations over usb0?

potentially a silly question but it's never stopped me before -- can
i do BBB network operations like "opkg update" and package installs
solely over the usb0 net interface?

  everything i've read always seems to imply you want the BBB
connected to a router via the net interface first, and the default
routing table is simply:

# route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
192.168.7.0 0.0.0.0 255.255.255.252 U 0 0 0 usb0

You would only need to find a way to share internet from the host to the bbb. This certainly should be possible. On windows ICS ( internet connection sharing )should be able to do this fine, but not sure how to do this on a NIX based system.

Perhaps naming the host to the bbb as the gateway might do the trick ? But im not positive and by no means an expert.

If your PC/laptop (“host PC”) runs Linux, the following should work. Assuming your Beaglebone has IP address 192.168.7.2 and your host PC has 192.168.7.1, as provided by the standard Angstrom image.

On your host PC, as root, say

`

This enables IP forwarding for packets between BB and outside world, through your host PC

echo 1 > /proc/sys/net/ipv4/ip_forward

This tells Linux to do outbound NAT, pretty much the same as your home router will be doing.

/sbin/iptables -t nat -A POSTROUTING -s 192.168.7.2 -j MASQUERADE

`

To make it permanent (on the host PC), add or uncomment this line in /etc/sysctl.conf

`
net.ipv4.ip_forward=1

`

… and add this line to a startup script. On most non systemd systems /etc/rc.local will probably be a good place.

`
/sbin/iptables -t nat -A POSTROUTING -s 192.168.7.2 -j MASQUERADE

`
Depending on your distro there are different official ways to save iptables rulesets. You might also need another iptables rule to allow traffic through in the first place, something along the lines of

`
/sbin/iptables -I FORWARD -s 192.168.7.2 -j ACCEPT

`

On your Beaglebone, you need a valid nameserver and a default route to your host PC. This is a safe way to do that (as root on the BB). DNS part:

`

To use a Google nameserver. changes will be overwritten the next time your BB is connected via USB or network.

You can also use the IP address of the nameserver your host PC itself uses.

echo “nameserver 8.8.8.8” > /etc/resolv.conf

`

… and the default route:

`
/sbin/route add default gw 192.168.7.1

`

That should be all. For other OS’es the BB side config would be the same, but you need to tell your OS to forward traffic from the beaglebone and NAT it.

-Bert