Hardware Reference
In-Depth Information
Solution
Recipe 5.11 shows how to connect BeagleBone Black to the Internet via the RJ45 Ethernet
connector. This recipe shows a way to connect without using the RJ45 connector.
A network is automatically running between the Bone and the host computer at boot time
using the USB. The host's IP address is 192.168.7.1 and the Bone's is
192.168.7.2 . Although your Bone is talking to your host, it can't reach the Internet in
general, nor can the Internet reach it. On one hand, this is good, because those who are up
to no good can't access your Bone. On the other hand, your Bone can't reach the rest of the
world.
Letting your bone see the world: setting up IP masquerading
You need to set up IP masquerading on your host and configure your Bone to use it. Here is
a solution that works with a host computer running Linux. Add the code in Example 5-1 to
a file called ipMasquerade.sh on your host computer.
Example 5-1. Code for IP Masquerading (ipMasquerade.sh)
#!/bin/bash
# These are the commands to run on the host to set up IP
# masquerading so the Bone can access the Internet through
# the USB connection .
# This configures the host , run ./ setDNS . sh to configure the Bone .
# Inspired by http : //thoughtshubham.blogspot.com/2010/03/
# internet - over - usb - otg - on - beagleboard . html
if [ $ # - eq 0 ] ; then
echo "Usage: $0 interface (such as eth0 or wlan0)"
exit 1
fi
interface = $1
hostAddr = 192.168 . 7.1
beagleAddr = 192.168 . 7.2
ip_forward = /proc/sys/net/ipv4/ip_forward
if [ ` cat $ip_forward ` == 0 ]
then
echo "You need to set IP forwarding. Edit /etc/sysctl.conf using:"
echo "$ sudo nano /etc/sysctl.conf"
echo "and uncomment the line \"net.ipv4.ip_forward=1\""
Search WWH ::




Custom Search