User:Carlsojs

Joel Carlson

Rose-Hulman Institute of Technology Interests:
 * Bachelor's of Computer Engineering, 2011
 * Master's of Electrical and Computer Engineering, 2011
 * Embedded Systems
 * DSP
 * Communication Systems
 * IC Design

Sharing Laptop Internet Connection with BeagleBoard
Two options: One uses Ubuntu's GUI network connections manager, the other requires modifying things yourself.

Option 1 - Using Ubuntu Network Connections GUI
 * 1) In Ubuntu, go to System -> Preferences -> Network Connections
 * 2) On the 'Wired' tab, select 'Auto eth0' and click 'Edit' (Note: name may be other than 'eth0'.  If nothing exists in this list, then make sure there is not an entry starting with 'auto eth0' in your /etc/network/interfaces file; such an entry prevents Network Manager from managing that interface.)
 * 3) Click the 'IPv4 Settings' tab and change 'Method' to 'Shared to other computers'
 * 4) Click apply
 * 5) Restart Ubuntu
 * 6) Connect the BeagleBoard to the laptop with the crossover Ethernet cable
 * 7) Boot the BeagleBoard - if Ubuntu was already running and the Ethernet cable was already plugged in, the BeagleBoard should automatically get assigned an IP address and you should be able to access the Internet on the BeagleBoard via the laptop's wireless connection

Option 2 - Modifying Things Yourself

This will setup a DHCP server on the host machine that will listen to the Ethernet port and assign an IP address to the BeagleBoard when it is connected with an Ethernet crossover cable. The host machine will then act as a router using NAT to send packets out the wifi interface.

A number of steps were taken from the Ubuntu Community Documentation.

Notes:
 * 'eth0' will refer to the internal interface (connected to the BeagleBoard) and 'wlan0' will refer to the external interface (connected to the Internet). Your interface names may differ.
 * A number of configuration files are changed. It's a good idea to save a backup copy of these before modifying them.

On the host machine, configure eth0 for a static IP: sudo ifconfig eth0 192.168.1.13 If you don't want to configure this after every boot, add an entry to /etc/network/interfaces with the following: auto eth0 address 192.168.1.13 netmask 255.255.255.0 network 192.168.1.0 broadcast 192.168.1.255

On the host machine, configure the IP tables to use NAT translation for routing packets: sudo iptables -A FORWARD -o wlan0 -i eth0 -s 192.168.1.0/24 -m conntrack --ctstate NEW -j ACCEPT sudo iptables -A FORWARD -m conntrack --ctstate ESTABLISHED,RELATED -j ACCEPT sudo iptables -A POSTROUTING -t nat -j MASQUERADE To avoid having to setup the IP tables after every boot, save the IP tables sudo iptables-save | sudo tee /etc/iptables.sav And add the following command to /etc/rc.local (or other appropriate file for your distribution) to be run at boot iptables-restore < /etc/iptables.sav

IP forwarding needs to be enabled: sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward" To make sure this is set after rebooting, add these lines to /etc/sysctl.conf: net.ipv4.conf.default.forwarding=1 net.ipv4.conf.all.forwarding=1

Install the DHCP server software sudo apt-get install dhcp3-server And edit the configuration file /etc/dhcp3/dhcpd.conf (comment out any already existing lines other than "ddns-update-style none;") default-lease-time 600; max-lease-time 7200; option subnet-mask 255.255.255.0; option broadcast-address 192.168.1.255; option routers 192.168.1.13;    #<--This must match the IP address you statically set for eth0 option domain-name-servers 137.112.4.196,137.112.5.28,137.112.12.11;   #<--Rose-Hulman's DNS servers (according to my laptop, at least) option domain-name "rose-hulman.edu";
 * 1) Added for DHCP with BeagleBoard

subnet 192.168.1.0 netmask 255.255.255.0 { range 192.168.1.14 192.168.1.14; #<--You can specify a larger range; I used this to force my BeagleBoard to always have the same IP so I could add an entry for that IP in /etc/hosts } You may need to edit /etc/default/dhcp3-server to specify the interface for the DHCP server INTERFACES="eth0" Then restart the DHCP server service sudo service dhcp3-server restart

You may need to reboot your host machine, and it may be necessary to run the command above to restart the DHCP server every time you boot (I'm not sure if it starts appropriately at boot).

Now connect the BeagleBoard to the host machine with a crossover Ethernet cable and boot the Beagle. After booting, run 'ifconfig' to see if the Beagle was assigned an IP address. If it does not have an IP address, try running the command 'dhclient usb0'.

Once the Beagle does have an IP address, try ping -c 3 -W 10 www.google.com to test if the setup is working correctly. If it complains about a bad name, the DNS servers are incorrect; try pinging a specific IP such as 8.8.8.8 to see if packets get through (though unless you want to rely on all IP addresses, you will need to get some DNS servers that work).