25 January 2012 ~ 0 Comments

Access to the Beagleworld for my little Beagle

So you have made a wrong choice and bought a Beagleboard without ethernet, looked so cheap, oh no…damn!

Let’s fix that easily. I assume you already have a booting card with some version of Angstrom and that you know what you are doing, so i won’t enter into trivial details. You will need:

On the Beagleboard:

  • We will use g_ether in auto insertion (next step) but you could
    modprobe -v g_ether

    yourself, the first time just in case

  • Fix the address for auto setup at /etc/network/interfaces:
# Ethernet/RNDIS gadget (g_ether) or LAN9514
 auto usb0
   iface usb0 inet static
   pre-up modprobe g_ether
   address 192.168.3.2
   netmask 255.255.255.0
   gateway 192.168.3.1
   post-down rmmod g_ether
  • Setup your real nameserver IP”s at /etc/resolv.conf

On your desktop

  • You also  need ‘g_ether’, so
    modprobe g_ether

    And maybe you wan to add ‘g_ether’ to /etc/modules for auto-loading on boot.

    You will see on the beagle a “link becomes ready” message on the dmesg output, look at it via serial.

  • You can use Network Manager and setup a fixed ip (192.168.3.1) for that interface or use any other tool for that.

Now you must be able to ping from both sides.

Internet Access

This needs additional configuration on the desktop. This a useful script:

# Assuming:
#-BEAGLE---+---DESKTOP PC------>
#-usb0-----|---usb0--eth0-->internet
#
echo "Remove any previous NAT setup"
iptables --flush
iptables --table nat --flush
iptables --delete-chain
iptables --table nat --delete-chain

echo "Setup NAT to forward packets from usb0 <---> eth0"
iptables --table nat --append POSTROUTING --out-interface eth0 -j MASQUERADE
iptables --append FORWARD --in-interface usb0 -j ACCEPT

echo "Enable packet forwarding in the kernel"
echo 1 >> /proc/sys/net/ipv4/ip_forward

Now your beagle will have access to the world.

Leave a Reply