Share network connection to BeagleBone Black through USB, OSX?

Hello,
I’m looking to connect my BeagleBone to the net by sharing my connection from my mac through USB.
I know that this is possible and I’ve read many badly written explanations for it online, but none of them really laid it out in a step by step manner for someone who is relatively inexperienced with coding.
Could anybody explain how to do this?

Thank you

Part of the challenge in explaining it clearly is that Apple has
broken Internet Connection Sharing on newer updates of Mac OS X.

When I want to enable connection sharing over USB, I run this script
on my Mac (you'll need a replacement for ssh-copy-id):
#!/bin/sh
GATEWAY_DEV=en0
HOST_DEV=en1
HOST_ADDR=192.168.7.1
BEAGLE_ADDR=192.168.7.2

sudo /sbin/ifconfig $HOST_DEV down
sudo /sbin/ifconfig bridge0 create
sudo /sbin/ifconfig bridge0 up
sudo /sbin/ifconfig bridge0 addm $GATEWAY_DEV
sudo /sbin/ifconfig bridge0 $HOST_ADDR
sudo /sbin/route add default -interface bridge0 -ifscope bridge0 -cloning
sudo /usr/sbin/sysctl -w net.inet.ip.forwarding=1
sudo /sbin/ipfw add 100 divert natd ip from any to any via $GATEWAY_DEV
sudo /usr/sbin/natd -interface $GATEWAY_DEV -use_sockets -same_ports
-unregistered_only -dynamic -clamp_mss -enable_natportmap
-natportmap_interface $HOST_DEV

/Users/jason/gentoo/usr/bin/ssh-copy-id $BEAGLE_ADDR
scp /etc/resolv.conf root@$BEAGLE_ADDR:/tmp
ssh root@$BEAGLE_ADDR "cat /etc/resolv.conf >> /tmp/resolv.conf.orig"
ssh root@$BEAGLE_ADDR "cp /tmp/resolv.conf /etc/resolv.conf"
ssh root@$BEAGLE_ADDR "/sbin/route add default gw $HOST_ADDR"

I’m on Beaglebone Black Rev. C with Debian Wheezy and this worked for me:

  1. Install Mac drivers from - http://beagleboard.org/Getting%20Started
  2. Connect BBB to Mac through USB
  3. On Mac, System Preferences > Sharing > Internet Sharing > Beaglebone Black
  4. System Preferences > Network, make sure BBB is in the left hand side and shows “Connected”
  5. After SSH’ing into the BBB, run “dhclient” (or "dhclient usb0” if that doesn’t work) and then try “ping google.com”.

Hope that works for you.

after running command dhclient or dhclient usb0 it shows ii

" PING 192.168.2.1 (192.168.2.1) 56(84) bytes of data.

— 192.168.2.1 ping statistics —

1 packets transmitted, 0 received, +1 errors, 100% packet loss, time 0ms

packet_write_wait: Connection to 192.168.7.2: Broken pipe "

what seems to be the problem?

The Problem is, that you destroy your own connection whilst being connected over it.

You start of by connecting to the BBB via USB and SSH?
root@192.168.7.2 ← this is the IP of the BBB when the session begins
Then you run the command to ask for a NEW IP for that interface via DHCP and your router answers.
The router has different DHCP-range gives the interface a new IP. That new IP is NOT THE SAME as your current IP. Hence the IP changes and therefore destroys your connection.

I hope I could help you.
I am currently looking for a way to keep the IP on USB0 and still have internet access with my BBB.
Should I find something, I will let you know :slight_smile:

Kind regards
Max

Actually this article explains it very well.
http://makezine.com/2012/07/16/use-your-mac-laptop-as-a-wireless-proxy-for-raspberry-pi/

Good article on how to configure single applications to use this proxy can be found here:
http://geekly-yours.blogspot.de/2012/11/setting-proxy-for-bash-in-debian.html

I guess that you could use IPTABLES to set it up globally, but my knowledge there is…let’s say “not up to date” :wink: