I’ve been having some fun playing with the Bone lately. It’s neat how you can attach it via the USB (and only USB) to a host computer and have the FAT partition mount on the post computer (Linux, Mac and Win7!). Then, one you eject the device a network connection between the Bone and the host appears.
The one thing missing is that the Bone can only talk to the host computer, not the rest of Internet land. Below is a script I’m developing, that’s run on the host, to give the Bone access to the Internet via IP masquerading through the host. You can also get the current version here [1].
I’ve tested it on a couple of Ubuntu 10.04 installs and it works. I’m open for suggestions for improvement.
My question is: How do I do the same with a Mac or Windows host?
if [ cat $ip_forward == 0 ]
then
echo “You need to set IP forwarding. Edit /etc/sysctl.conf using:”
echo “$ sudo gedit /etc/sysctl.conf”
echo "and uncomment the line “net.ipv4.ip_forward=1"”
echo “to enable forwarding of packets. Then run the following:”
echo “$ sudo sysctl -p”
exit 1
else
echo “IP forwarding is set.”
fi
Thanks for this great example. Do you have plans to put similar
instructions on the eLinux wiki? I'm just wondering if I should put a
link to this post in the G+ feed or wait for some other link.
Thanks to looking at this, I went through the process of figuring out
how to do the same thing with a Mac host. It turns out to be pretty
simple, but the BeagleBone acting as a DHCP host on the
Ethernet-over-USB solution will seem at first to work against you
(though it is actually mostly irrelevant). The solution is to turn on
Internet Sharing in the Preferences pane, then use the serial
connection to issue a 'udhcpc -i usb0' to instruct the BeagleBone to
request its network connection information from the Mac. Thanks for
the encouragement to figure this out!
I've been having some fun playing with the Bone lately. It's neat how you
can attach it via the USB (and only USB) to a host computer and have the FAT
partition mount on the post computer (Linux, Mac and Win7!). Then, one you
eject the device a network connection between the Bone and the host appears.
The one thing missing is that the Bone can only talk to the host computer,
not the rest of Internet land. Below is a script I'm developing, that's run
on the host, to give the Bone access to the Internet via IP masquerading
through the host. You can also get the current version here [1].
I've tested it on a couple of Ubuntu 10.04 installs and it works. I'm open
for suggestions for improvement.
My question is: How do I do the same with a Mac or Windows host?
I had my Bone talking to the world via USB through at Mac yesterday, but I’m unable to make it work today. The udhcpc -i usb0 command keeps saying Sending discover… like it’s not discovering anything. I’ve doubled checked settings, rebooted (both Bone and Mac) and it’s still not discovering. Any suggestions?
I’m also looking for instructions on making this work with Windows. I can see the USB network come up on both sides, but I can’t even ping from one to the other. That is beagle$ ping 192.168.7.1 and host$ ping 192.168.7.1 both return nothing.
I had my Bone talking to the world via USB through at Mac yesterday, but I’m unable to make it work today. The udhcpc -i usb0 command keeps saying Sending discover… like it’s not discovering anything. I’ve doubled checked settings, rebooted (both Bone and Mac) and it’s still not discovering. Any suggestions?
I’m also looking for instructions on making this work with Windows. I can see the USB network come up on both sides, but I can’t even ping from one to the other. That is beagle$ ping 192.168.7.1 and host$ ping 192.168.7.1 both return nothing.
Any suggestions?
What is the output of ‘ifconfig’? Can you please provide serial logs?
Can you provide screen captures of your settings on the Mac? Did you watch the video?
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
However, I've seen it have problems with larger packets that causes
connections to simply hang. The ssh socket forwarding doesn't have that
same issue.
My host is running Ubuntu 12.04. When I run the script below I’m able to ssh to my bone from the host via ssh -XC 192.168.7.2
On the bone I can:
bone$ ping 173.194.46.37
PING 173.194.46.37 (173.194.46.37) 56(84) bytes of data.
64 bytes from 173.194.46.37: icmp_req=1 ttl=54 time=372 ms
64 bytes from 173.194.46.37: icmp_req=2 ttl=54 time=381 ms
64 bytes from 173.194.46.37: icmp_req=3 ttl=54 time=250 ms
So I’m able to reach the outside world from by bone via the host, but DNS doesn’t appear to be working. This worked fine before switching to the new image with the 3.8 kernel and connman.
So how can I get the bone to use DNS under connman?
–Mark
#!/bin/bash
These are the commands to run on the host to setup IP masquerading so the Beagle
can access the Internet through the USB connection.
if [ cat $ip_forward == 0 ]
then
echo “You need to set IP forwarding. Edit /etc/sysctl.conf using:”
echo “$ sudo gedit /etc/sysctl.conf”
echo "and uncomment the line “net.ipv4.ip_forward=1"”
echo “to enable forwarding of packets. Then run the following:”
echo “$ sudo sysctl -p”
exit 1
else
echo “IP forwarding is set on host.”
fi