Difference between revisions of "EBC Exercise 02 Out-of-the-Box, Bone"

From eLinux.org
Jump to: navigation, search
m
m (ssh and changing the password: Added RNDIS link)
 
(49 intermediate revisions by 10 users not shown)
Line 1: Line 1:
 
[[Category:ECE497]]
 
[[Category:ECE497]]
 
{{YoderHead}}
 
{{YoderHead}}
== Kernel 3.8 ==
 
{{EBC3.8}}We'll be running the 3.8 kernel, check out these [http://beagleboard.org/Getting%20Started instructions] for getting started.
 
  
=== Internet Connection ===
+
{{EBC3.8}}'''These instructions are for the 3.8 and newer kernels.'''  [[EBC Exercise 02 Out-of-the-Box, Bone 3.2 Kernel]] has instructions for the 3.2 kernel.
  
One of the slickest features of the Bone is it's ability to access the Internet through the USB connection.
+
== Internet Connection to the Outside World ==
 +
Once the Bone can connect to the host, the host can be used for forward requests from the Bone to the Internet.  Follow the instructions below to set up your host and Bone so the bone can access the internet through your host.
  
==== Linux ====
+
=== Linux ===
On your host computer run:
+
==== Setting up VirtualBox ====
 +
If you are running a virtual machine make sure the guest OS (Ubuntu) has captured the USB from the host OS (Windows).
 +
[[EBC_Exercise_01_Start_Here#The_Linux_host_computer]] shows how to install Guest Additions on VirtualBox.  Once installed
 +
be sure to capture the USB by going to <code>Devices:USB</code> and select the Beagle.  Then go to <code>Devices:USB settings...</code>
 +
Click on the ''Add'' icon on the right and check the Beagle.  This will make it permanent.
  
  host$ '''ifconfig'''
+
==== See your networks with ip a ====
  eth0    Link encap:Ethernet  HWaddr 00:18:8b:72:b8:c2 
+
Run:
          inet addr:137.112.41.109 Bcast:137.112.41.255  Mask:255.255.255.0
+
 
          inet6 addr: fe80::218:8bff:fe72:b8c2/64 Scope:Link
+
  host$ '''ip a'''
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
+
  1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
          RX packets:8481193 errors:0 dropped:0 overruns:0 frame:0
+
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
          TX packets:1871287 errors:0 dropped:0 overruns:0 carrier:0
+
    inet 127.0.0.1/8 scope host lo
          collisions:0 txqueuelen:1000
+
        valid_lft forever preferred_lft forever
          RX bytes:3172154531 (3.1 GB)  TX bytes:203188180 (203.1 MB)
+
    inet6 ::1/128 scope host
          Interrupt:19
+
        valid_lft forever preferred_lft forever
   
+
  2: '''enp0s25''': <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
eth4    Link encap:Ethernet  HWaddr d4:94:a1:39:ff:ff
+
    link/ether 54:ee:75:19:8d:53 brd ff:ff:ff:ff:ff:ff
          inet addr:192.168.7.1 Bcast:192.168.7.3  Mask:255.255.255.252
+
    inet 10.0.4.102/24 brd 10.0.4.255 scope global dynamic noprefixroute enp0s25
          inet6 addr: fe80::d694:a1ff:fe39:ffff/64 Scope:Link
+
        valid_lft 84299sec preferred_lft 84299sec
          UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
+
    inet6 fe80::e6d0:8d85:4488:6b5f/64 scope link noprefixroute
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
+
        valid_lft forever preferred_lft forever
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
+
5: wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
          collisions:0 txqueuelen:1000
+
    link/ether 28:b2:bd:03:68:d0 brd ff:ff:ff:ff:ff:ff
          RX bytes:2775 (2.7 KB)  TX bytes:1234 (1.2 KB)
+
6: gpd0: <POINTOPOINT,MULTICAST,NOARP> mtu 1400 qdisc fq_codel state DOWN group default qlen 500
+
    link/none
lo      Link encap:Local Loopback 
+
    inet 137.112.193.14/32 scope global gpd0
          inet addr:127.0.0.1 Mask:255.0.0.0
+
        valid_lft forever preferred_lft forever
          inet6 addr: ::1/128 Scope:Host
+
  28: enx1cba8ca2ed6d: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
+
    link/ether 1c:ba:8c:a2:ed:6d brd ff:ff:ff:ff:ff:ff
          RX packets:37315 errors:0 dropped:0 overruns:0 frame:0
+
    inet 192.168.6.1/24 brd 192.168.6.255 scope global dynamic noprefixroute enx1cba8ca2ed6d
          TX packets:37315 errors:0 dropped:0 overruns:0 carrier:0
+
        valid_lft 932sec preferred_lft 932sec
          collisions:0 txqueuelen:0
+
    inet6 fe80::3ad0:6711:a2ec:50f0/64 scope link noprefixroute
          RX bytes:3665320 (3.6 MB) TX bytes:3665320 (3.6 MB)
+
        valid_lft forever preferred_lft forever
You'll see a new network has appeared, '''eth4''' in my case. The IP address is '''192.168.7.1'''.  There's a good chance the Bone is at '''192.168.7.''2'''''.  Try connecting to it.
+
29: enx1cba8ca2ed6b: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
  host$ '''ssh -X root@192.168.7.2'''
+
    link/ether 1c:ba:8c:a2:ed:6b brd ff:ff:ff:ff:ff:ff
  beagle$  
+
    inet 192.168.7.1/24 brd 192.168.7.255 scope global dynamic noprefixroute enx1cba8ca2ed6b
You are now logged into the Bone through the network.  This is much faster than the serial port (.115M vs. 100M) and supports many interesting network things.  The only problem is, the Beagle doesn't know how to access the Internet through the host. Get back to the host computer by entering RETURN ~ ^Z.  That is, hit RETURN, then ~ (it's up there near the ESC key) and then Ctrl-Z.  This gets you back to your host, but leaves the ssh connection running.   
+
        valid_lft 1125sec preferred_lft 1125sec
 +
    inet6 fe80::cd04:f44f:cf68:f98a/64 scope link noprefixroute
 +
        valid_lft forever preferred_lft forever
 +
 
 +
Note the name associated with the local connection between you Linux host and the InternetIn my case it's '''enp0s25'''. We'll use it later.
 +
 
 +
==== ssh and changing the password ====
 +
You'll see two new networks have appeared, '''enx1cba8ca2ed6d'''  and '''enx1cba8ca2ed6b''' in my case. The IP address of your host is '''192.168.7.1'''.  There's a good chance the Bone is at '''192.168.7.''2'''''.  Try connecting to it.  The default password is '''temppwd'''.
 +
  host$ '''ssh debian@192.168.7.2'''
 +
  bone$  
 +
You are now logged into the Bone through the network.  This is much faster than the serial port (.115M vs. 100M) and supports many interesting network operations.   
  
Copy the following lines into a file call '''host.ipForward.sh'''
+
Note:  If the '''ssh''' fails and you are running WSL, try following the instructions
 +
here https://forum.beagleboard.org/t/debian-12-x-major-changes-ncm-only-iwd-for-wifi/36176 to enable RNDIS.
  
<pre>
+
Take a look around. What do you find?
#!/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.
 
# Inspired by http://thoughtshubham.blogspot.com/2010/03/internet-over-usb-otg-on-beagleboard.html
 
  
if [ $# -eq 0 ] ; then
+
Since everyone knows the default password, change it to something else.
echo "Usage: $0 interface (such as eth0 or wlan0)"
 
exit 1
 
fi
 
  
interface=$1
+
bone$ '''passwd'''
hostAddr=192.168.7.1
+
Changing password for debian.
beagleAddr=192.168.7.2
+
(current) UNIX password:
ip_forward=/proc/sys/net/ipv4/ip_forward
+
Enter new UNIX password:
 +
Retype new UNIX password:
 +
passwd: password updated successfully
  
if [ `cat $ip_forward` == 0 ]
+
The only problem is, the Beagle doesn't know how to access the Internet through the host. Get back to the host computer:
  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
 
# Setup  IP masquerading on the host
 
sudo iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o $interface -j MASQUERADE
 
  
# Check to see what nameservers the host is using and copy these to the same
+
  bone$ '''exit'''
# file on the Beagle
 
# This makes it so you can connect to the Beagle without using your password.
 
ssh-copy-id root@$beagleAddr
 
# Save the /etc/resolv.conf on the Beagle in case we mess things up.
 
ssh root@$beagleAddr "mv -n /etc/resolv.conf /etc/resolv.conf.orig"
 
# Copy the resolv.conf file to the Beagle.  Now the Beagle will use the
 
# same name servers as the host.
 
cat /etc/resolv.conf - << EOF > /tmp/resolv.conf
 
nameserver 137.112.18.59
 
nameserver 137.112.5.28
 
nameserver 137.112.4.196
 
search rose-hulman.edu
 
nameserver 8.8.8.8
 
nameserver 8.8.4.4
 
EOF
 
scp /tmp/resolv.conf root@$beagleAddr:/etc
 
# Tell the beagle to use the host as the gateway.
 
ssh root@$beagleAddr "/sbin/route add default gw $hostAddr"
 
</pre>
 
  
Now run:
+
==== Setting up shortcuts to make life easier ====
host$ '''chmod +x host.ipForward.sh'''
+
We'll be ssh'ing from the host to the bone often, here are some shortcuts I use so instead of typing '''ssh debian@192.168.7.2''' and a password every time.
host$ '''./host.ipForward.sh ''eth0'''''
+
I can enter '''ssh bone''' and no password.
This will give you instructions on how to set up your host and will remotely set up your Beagle.
 
Note: If you are using a wireless connection you should use  host$ '''./host.ipForward.sh ''wlan0'''''
 
  
Once ./host.ipForward.sh has been run you can:
+
First edit '''/etc/hosts''' and add a couple of lines.
host$ '''fg'''
 
ssh -X root@192.168.7.2
 
(Hit RETURN)
 
beagle$ '''ping google.com'''
 
  
You should see Google responding. Hit Ctrl-C to stop.
+
host$ '''sudo nano /etc/hosts'''
  
''Note: If you are using Ubuntu 12.04 and having an issue connecting to the internet, you may need to add a line to the /etc/resolv.conf file on the Bone. If ping google.com returns an "unknown host" error, this means that the Bone cannot resolve the url google.com to an IP address. Users with an Ubuntu 12.04 host may see this issue because the resolv.conf that Ubuntu uses (and is copied to the Bone in the host.ipForward.sh script) is not compatible with the Bone. The solution is to run the host.ipForward script as normal, then add the line "nameserver 8.8.8.8" above the existing entry in /etc/resolv.conf (run "nano /etc/resolv.conf" on the Bone to edit the file). This configures the Bone to use [https://developers.google.com/speed/public-dns/ Google's Public DNS Server].''
+
You may use whatever editor you want.  I suggest '''nano''' since it's easy to figure out. Add the following to the end of /etc/hosts and quit the editor.
  
Congratulations! Your Beagle is now on the network through your host computer.
+
  192.168.7.2    bone
 +
192.168.8.1    bone2
  
== Kernel 3.2 ==
+
If you are running wsl you need to edit '''/etc/wsl.conf''' or else these changes will be overwritten.
{{EBC3.2}}'''These instructions are for the 3.2 kernel.'''
 
  
The BeagleBone can do many neat things right out of the box using just the USB cable and SD card that come with it. Before hooking up anything, if you are running Linux or OSX on your host computer, open a terminal at run:
+
host$ '''sudo nano /etc/wsl.conf'''
  
host$ '''ls /dev/tty* > /tmp/tty'''
+
To stop the overwrite process, simply add the following then save and exit.
  
This will record what devices are present on you host computer. Once you plug the bone in it will create a new device. Windows users don't have to do anything here.
+
  [network]
 +
  generateHosts = false
  
Install the SD card (not the one that says Linux SDK on it) and attach the Bone to a host computer via the USB cable. The little USB connector goes to the Beagle in the connector on the bottom of the board near the Ethernet connector. Connect the large end of the USB cable to a host computer. The host can be either Linux, Mac, or Windows (though if you are doing development, consider running Linux on the host.)  I give instructions for each.
+
Now you can connect with
 +
host$ '''ssh debian@bone'''
  
The Beagle, powered via the USB, will boot up.  You should initially see two LEDs blinking, near the Ethernet connector. The one labeled '''0''' blinks a heartbeat patternLED '''1''' blinks when the SD card is being accessed. After about 30 seconds LED 1 will stop blinking. The Bone is booted.
+
Let's make it so you don't have to enter '''debian'''.  On your host computer, put the following in '''~/.ssh/config'''  (Note:  ~ is a shortcut for your home directory.)
  
Here are some of the things it can do.
+
Host bone
 +
  User debian
 +
  UserKnownHostsFile /dev/null
 +
  StrictHostKeyChecking no
 +
 +
Host bone2
 +
  User debian
 +
  UserKnownHostsFile /dev/null
 +
  StrictHostKeyChecking no
  
== YouTube Introduction ==
+
These say that whenever you login to bone or bone2, login as '''debian'''.
 +
Now you can enter.
  
[http://www.youtube.com/watch?v=z6b4zlh0IrE&feature=bf_next&list=UUf_sAmhBw7Tj7-2ujmLFoQg Here's] a nice overview of the BeagleBone. It shows how to work with it using a Windows host.
+
  host$ '''ssh bone'''
  
== USB Drive ==
+
One last thing, let's make it so you don't have to add a password.
 +
Back to your host.
  
On your host you will notice a new folder appearing. On Linux and OSX it's call '''BEAGLE_BONE'''. On Windows it's '''Beagle Bone Getting Started'''.  Open it up and look around. The '''README.html''' gives lots of information about getting going with the BoneLook at it in detail after going though this page.
+
host$ '''ssh-keygen'''
 +
Accept all the defaults and then
 +
  host$ '''ssh-copy-id bone'''
 +
Now all you have to enter is
 +
  host$ '''ssh bone'''
 +
and no password is required.
 +
If you, especially virtual machine users, get an error says "sign_and_send_pubkey: signing failed: agent refused operation", you can solve this by entering
 +
  host$ '''ssh-add'''
 +
which adds the private key identities to the authentication agent. Then you should be able to
 +
  host$ '''ssh bone'''
 +
without problems.
  
When you are doing exploring the files, eject the drive (don't select ''SAFELY REMOVE DRIVE'')Once the drive is ejected, the network will start up over the USB.
+
==== Setting up a root login ====
 +
By default the image we are running doesn't allow a root login.  You can always '''sudo''' from debian, but sometimes it's nice to login as rootHere's how to setup root so you can login from your host without a password.
  
== Built in USB to serial adapter ==
+
host$ '''ssh bone'''
 +
bone$ '''sudo bash'''
 +
root@bone# '''nano /etc/ssh/sshd_config'''
  
The Beagle xM has a serial port connector on board, but the Bone doesn't. Instead you access the serial port through the USB connector. The trick is figuring out how to access it.  
+
Search for the line
 +
  #PermitRootLogin prohibit-password
 +
and change it to
 +
  PermitRootLogin yes
  
=== Linux, OSX ===
+
(The # symbol indicates a comment and must be removed in order for the setting to take effect.)
  
Run the following:
+
Save the file and quit the editor. Restart ssh so it will reread the file.
  host$ '''ls /dev/tty* > /tmp/tty2'''
+
  root@bone# '''systemctl restart sshd'''
host$ '''diff /tmp/tty*'''
 
  ttyUSB1
 
host$ '''screen /dev/''ttyUSB1'' 115200'''  (Linux)
 
host$ '''screen /dev/tty.usb*B 115200''' (OSX)
 
  
The first line lists what devices are out there.  The second compares that list to the list made earlier. What appears is the USB to serial device on the Bone. The last line starts a serial port program that attaches to that deviceNotice the ''ttyUSB1'' is the same string as returned by the diff command.
+
And assign a password to root.
 +
  root@bone# '''passwd'''
  
=== Windows ===
+
Now open another window on your host computer and enter:
To find where the serial port appears in Windows, click on the start menu and search for '''Device Manager''' and run it.
+
host$ '''ssh-copy-id root@bone'''
 +
and enter the root password.  Test it with:
 +
host$ '''ssh root@bone'''
 +
You should be connected without a password.  Now go back to the Bone and turn off the root password access.
  
[[File:Device_Manager.png|300px‎]]
+
root@bone# '''nano /etc/ssh/sshd_config'''
 +
Restore the line:
 +
#PermitRootLogin prohibit-password
 +
and restart sshd.
 +
root@bone# '''systemctl restart sshd'''
 +
root@bone# '''exit'''
 +
bone$ '''exit'''
  
Select '''Ports''' and look for USB Serial PortIn my case the port appears at '''COM6'''.
+
You should now be able to got back to your host computer and login as root on the bone without a password.
 +
  host$ '''ssh root@bone'''
  
[[File:Port.png‎|300px]]
+
You have access to your bone without passwords only from you host computer.  Try it from another computer and see what happens.
  
Start up a [[ECE497_Tips_and_Tricks#Serial_Port serial port]] program and connect.  The baud rate is 115200.
+
==== Set Up Git ====
  
=== Logging in ===
+
We need to run some files that are in the class '''git''' repository.  We'll learn more about using git later.  Here I'll just show you how to get the files. Here we are installing these files on your host computer, later we'll install them on your Beagle.
  
Hit RETURN and you'll see the following.  Login as '''root''' and look around.
+
On my host computer I had to run
  
  .---O---.                                         
+
  host$ '''sudo apt update'''
|      |                  .-.          o o       
+
  host$ '''sudo apt install git'''
|  |  |-----.-----.-----.| |  .----..-----.-----.
 
|      |    | __  |  ---'| '--.|  .-'|    |    |
 
|  |  |  |  |    |---  ||  --'|  |  |  '  | | | |
 
'---'---'--'--'--.  |-----''----''--' '-----'-'-'-'
 
                -' |
 
                '---' 
 
 
The Angstrom Distribution beaglebone ttyO0
 
 
Angstrom v2012.01-core - Kernel 3.2.5+
 
 
beaglebone login: '''root'''
 
Last login: Fri Jul 13 01:28:06 UTC 2012 on ttyO0
 
root@beaglebone:~#
 
  
== Internet Connection ==
+
==== Make Room for Files ====
 +
(Note: the following should be done automatically the first time you reboot your bone.
 +
Try it, reboot and if you see your whole SD card you can skip to the next section.)
  
One of the slickest features of the Bone is it's ability to access the Internet through the USB connection.  The network connection starts up ''after'' you've ejected the '''BEAGLE_BONE''' drive that appears. Do it now.
+
Check out bb-growpart and bb-resizefs on Bullseye.
  
=== Linux ===
 
After ejecting, run:
 
  
host$ '''ifconfig'''
+
Connect to your Beagle and see how much free disk space you have:
eth0    Link encap:Ethernet  HWaddr 00:18:8b:72:b8:c2 
 
          inet addr:137.112.41.109  Bcast:137.112.41.255  Mask:255.255.255.0
 
          inet6 addr: fe80::218:8bff:fe72:b8c2/64 Scope:Link
 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 
          RX packets:8481193 errors:0 dropped:0 overruns:0 frame:0
 
          TX packets:1871287 errors:0 dropped:0 overruns:0 carrier:0
 
          collisions:0 txqueuelen:1000
 
          RX bytes:3172154531 (3.1 GB)  TX bytes:203188180 (203.1 MB)
 
          Interrupt:19
 
 
eth4    Link encap:Ethernet  HWaddr d4:94:a1:39:ff:ff 
 
          inet addr:192.168.7.1  Bcast:192.168.7.3  Mask:255.255.255.252
 
          inet6 addr: fe80::d694:a1ff:fe39:ffff/64 Scope:Link
 
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
 
          TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
 
          collisions:0 txqueuelen:1000
 
          RX bytes:2775 (2.7 KB)  TX bytes:1234 (1.2 KB)
 
 
lo      Link encap:Local Loopback 
 
          inet addr:127.0.0.1  Mask:255.0.0.0
 
          inet6 addr: ::1/128 Scope:Host
 
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
 
          RX packets:37315 errors:0 dropped:0 overruns:0 frame:0
 
          TX packets:37315 errors:0 dropped:0 overruns:0 carrier:0
 
          collisions:0 txqueuelen:0
 
          RX bytes:3665320 (3.6 MB)  TX bytes:3665320 (3.6 MB)
 
You'll see at new network has appear, '''eth4''' in my case. The IP address is '''192.168.7.1'''.  There's a good chance the Bone is at '''192.168.7.''2'''''.  Try connecting to it.
 
host$ '''ssh -X root@192.168.7.2'''
 
beagle$
 
You are now logged into the Bone through the network.  This is much faster than the serial port (.115M vs. 100M) and supports many interesting network things.  The only problem is, the Beagle doesn't know how to access the Internet through the host. Get back to the host computer by entering RETURN ~ ^Z.  That is, hit RETURN, then ~ (it's up there near the ESC key) and then Ctrl-Z.  This gets you back to your host, but leaves the ssh connection running. 
 
  
Copy the following lines into a file call '''host.ipForward.sh'''
+
host$ '''ssh bone'''
 +
bone$ '''df -h'''
 +
Filesystem      Size  Used Avail Use% Mounted on
 +
udev            215M    0  215M  0% /dev
 +
tmpfs            49M  1.6M  47M  4% /run
 +
/dev/mmcblk0p1  7.4G  3.7G  3.4G  53% /
 +
tmpfs          243M    0  243M  0% /dev/shm
 +
tmpfs          5.0M    0  5.0M  0% /run/lock
 +
tmpfs          243M    0  243M  0% /sys/fs/cgroup
 +
tmpfs            49M    0  49M  0% /run/user/1000
  
<pre>
+
'''/dev/mmcblk0p1''' has some 7.4G and 3.4G is still available.  You probably have just shy of 4G and not much available.
#!/bin/bash
+
What's going on here?  You should have a least an 8G card, but 8G isn't showing up? 
# These are the commands to run on the host to setup IP masquerading so the Beagle
+
It turns out the image you downloaded was for a 4G card, so it isn't set up to use you whole memory card. 
#  can access the Internet through the USB connection.
+
The solution is one command away.
# Inspired by http://thoughtshubham.blogspot.com/2010/03/internet-over-usb-otg-on-beagleboard.html
+
bone$ '''/opt/scripts/tools/grow_partition.sh'''
 +
This will grow your partition to fill your whole card. A reboot is necessary:
 +
bone$ '''reboot'''
 +
Once rebooted,
 +
host$ '''ssh bone'''
 +
bone$ '''df -h'''
 +
and you should see plenty of disk space.
  
if [ $# -eq 0 ] ; then
+
==== Get the Files ====
echo "Usage: $0 interface (such as eth0 or wlan0)"
 
exit 1
 
fi
 
  
interface=$1
+
It only takes one command to pull down all the files.
hostAddr=192.168.7.1
 
beagleAddr=192.168.7.2
 
ip_forward=/proc/sys/net/ipv4/ip_forward
 
  
if [ `cat $ip_forward` == 0 ]
+
host$ '''git clone https://github.com/MarkAYoder/BeagleBoard-exercises.git exercises --depth=1'''
  then
+
(The whole repo is some 1013MUsing '''--depth=1''' you only get the recent history and it only takes 200M.)
    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
 
# Setup IP masquerading on the host
 
sudo iptables -t nat -A POSTROUTING -s 192.168.0.0/16 -o $interface -j MASQUERADE
 
  
# Check to see what nameservers the host is using and copy these to the same
+
This will take a while since it's getting all the course files, including pdf files of the course PowerPoint.
#  file on the Beagle
 
# This makes it so you can connect to the Beagle without using your password.
 
ssh-copy-id root@$beagleAddr
 
# Save the /etc/resolv.conf on the Beagle in case we mess things up.
 
ssh root@$beagleAddr "mv -n /etc/resolv.conf /etc/resolv.conf.orig"
 
# Copy the resolv.conf file to the Beagle.  Now the Beagle will use the
 
# same name servers as the host.
 
cat /etc/resolv.conf - << EOF > /tmp/resolv.conf
 
nameserver 137.112.18.59
 
nameserver 137.112.5.28
 
nameserver 137.112.4.196
 
search rose-hulman.edu
 
nameserver 8.8.8.8
 
nameserver 8.8.4.4
 
EOF
 
scp /tmp/resolv.conf root@$beagleAddr:/etc
 
# Tell the beagle to use the host as the gateway.
 
ssh root@$beagleAddr "/sbin/route add default gw $hostAddr"
 
</pre>
 
  
Now run:
+
==== Running ipMasquerade.sh ====
  host$ '''chmod +x host.ipForward.sh'''
+
Now that the files are installed, run:
  host$ '''./host.ipForward.sh ''eth0'''''
+
  host$ '''cd exercises/setup'''
This will give you instructions on how to set up your host and will remotely set up your Beagle.
+
  host$ '''./ipMasquerade.sh ''enp0s25'''''
Note: If you are using a wireless connection you should use host$ '''./host.ipForward.sh ''wlan0'''''
+
Plug in for ''enp0s25'' whatever is returned when you run '''ip a''' earlier.
 +
This will give you instructions on how to set up your host.
 +
Note: If you are using a wireless connection you should use
  
Once ./host.ipForward.sh has been run you can:
+
host$ '''./ipMasquerade.sh ''wlp16s0'''''
host$ '''fg'''
+
where ''wlp16s0'' is what is returned by '''ip a''' for your wireless connection on your host.
ssh -X root@192.168.7.2
 
(Hit RETURN)
 
beagle$ '''ping google.com'''
 
  
You should see Google responding. Hit Ctrl-C to stop.
+
Once ./ipMasquerade.sh has been run you can:
 +
host$ '''./firstssh.sh'''
 +
Now you should have network access on the Bone.
 +
bone$ '''ping -c2 google.com'''
  
''Note: If you are using Ubuntu 12.04 and having an issue connecting to the internet, you may need to add a line to the /etc/resolv.conf file on the Bone. If ping google.com returns an "unknown host" error, this means that the Bone cannot resolve the url google.com to an IP address. Users with an Ubuntu 12.04 host may see this issue because the resolv.conf that Ubuntu uses (and is copied to the Bone in the host.ipForward.sh script) is not compatible with the Bone. The solution is to run the host.ipForward script as normal, then add the line "nameserver 8.8.8.8" above the existing entry in /etc/resolv.conf (run "nano /etc/resolv.conf" on the Bone to edit the file). This configures the Bone to use [https://developers.google.com/speed/public-dns/ Google's Public DNS Server].''
+
You should see Google responding.
  
 
Congratulations!  Your Beagle is now on the network through your host computer.
 
Congratulations!  Your Beagle is now on the network through your host computer.
  
=== OSX===
+
You will have to run '''ipMasquerade.sh''' only after rebooting your host computer and run '''firstssh.sh''' after rebooting your bone. Once '''firstssh''' has be run you should ssh from your host with the standard ssh command.
After ejecting
+
 
 +
====Troubleshooting====
 +
 
 +
=====Unknown Host=====
 +
 
 +
If you get an unknown host response when attempting to ping google.com, and you are off campus, try pinging the Google DNS by IP address. Run:
 +
 
 +
bone$ '''ping 8.8.8.8'''
 +
 
 +
If you are on campus, run:
 +
 
 +
bone$ '''ping 137.112.5.28'''
 +
 
 +
If you now see responses by pinging a specific IP, it is possible that a firewall on your host computer is blocking the Beagle's access to the DNS when attempting to ping by domain name. On Ubuntu/Mint, run:
 +
 
 +
host$ '''sudo ufw disable'''
 +
Firewall stopped and disabled on system startup
 +
 
 +
You should get a response, such as above, that the firewall will be disabled upon next startup. After saving anything important, restart your host through the start menu or run:
 +
 
 +
host$ '''reboot'''
 +
 
 +
Repeat this exercise and attempt to ping Google by domain name again. If you now receive responses, then the firewall was indeed the issue. Otherwise, the internet is your friend. Use your host computer to try and find a solution. Feel free to add solutions here when you find them
 +
 
 +
=====NetworkManager Issues=====
 +
 
 +
If you continue to have problems with '''firstssh.sh''' and receive errors regarding the network manager command line tool (nmcli) such as:
 +
mv: cannot stat '/etc/resolv.conf'
 +
or
 +
nmcli failed, trying older 'list' instead of 'show'
 +
nmncli failed again, giving up. . .
 +
then you may have success with the following solution.
 +
 
 +
Access your bone with '''ssh bone''' and check to see which network interface is tethered to your host. It should be usb0, already assigned the ip address of '''192.168.7.2.''' If so, simply enter the following in the command line:
 +
bone$ '''route add default gw 192.168.7.1'''
 +
 
 +
Now return to your host machine and check what your internet facing interface is. It should be some '''eno''' interface for a wired connection or '''wlp''' interface for wireless. Your Bone should be on one of the usb ports, starting with '''enx''' and showing an ip address for your host machine of '''192.168.7.1.''' The example commands below will use '''wlp''' in place of the internet facing interface and '''enx''' in place of the Bone interface.
 +
host$ '''iptables --table nat --append POSTROUTING --out-interface wlp -j MASQUERADE'''
 +
host$ '''iptables --append FORWARD --in-interface enx -j ACCEPT'''
 +
host$ '''echo 1 > /proc/sys/net/ipv4/ip_forward'''
 +
 
 +
You should now ssh into your Bone and see if the routing change has worked. These commands are essentially what the '''ipMasquerade.sh''' and '''firstssh.sh''' scripts already do, but I started to encounter problems with them and had more success performing the operations manually.
 +
 
 +
=== OS X ===
 +
I haven't checked these instructions this year.  Please report your results and update if needed.
  
 
# go to '''System Preferences''' and select '''Network'''
 
# go to '''System Preferences''' and select '''Network'''
Line 311: Line 298:
  
 
  host$ '''screen /dev/ttyusb*B 115200'''
 
  host$ '''screen /dev/ttyusb*B 115200'''
  beagle$ '''udhcpc -i usb0'''
+
  bone$ '''udhcpc -i usb0'''
  beagle$ '''ping google.com'''
+
  bone$ '''ping google.com'''
  
 
This is all nicely shown [http://www.youtube.com/watch?v=Cf9hnscbSK8&feature=youtu.be here] in this silent YouTube movie.
 
This is all nicely shown [http://www.youtube.com/watch?v=Cf9hnscbSK8&feature=youtu.be here] in this silent YouTube movie.
  
Congratulations, you now have a connection to the Internet.
+
Congratulations, you now have a connection from your BeagleBone to the Internet.
  
 
=== Windows 7 ===
 
=== Windows 7 ===
 +
I haven't checked these either.  Please report results and update if needed.
 +
 
There are several ways of running ssh on Windows 7. Below are a couple of tools that you can use.
 
There are several ways of running ssh on Windows 7. Below are a couple of tools that you can use.
 
==== msysgit ====
 
Install [http://msysgit.github.com/ msysgit]. This is a version of git for Windows based on msys (a unix like shell for Windows) which includes ssh. This solution is simple if all you need to do is connect to your bone.
 
 
==== Cygwin ====
 
Install [http://cygwin.com/ Cygwin]. There are many packages that you can install that aren't installed by default:
 
 
Required
 
# openssh
 
 
Optional
 
# make
 
# gcc-core
 
# gcc-g++
 
# gdb
 
# git
 
 
This solution is more involved, but it allows you to install development tools.
 
  
 
==== Environment Setup ====
 
==== Environment Setup ====
Line 363: Line 334:
 
# Check the box to '''Allow other network users to connect through this computer's Internet connection'''
 
# Check the box to '''Allow other network users to connect through this computer's Internet connection'''
 
# Select your bone's local area connection for the '''Home networking connection''' (if you cannot choose the local area connection, turn your internet connection sharing off and then back on)
 
# Select your bone's local area connection for the '''Home networking connection''' (if you cannot choose the local area connection, turn your internet connection sharing off and then back on)
 +
# Return to '''Change adapter settings'''
 +
# Right click your Bone's internet connection and go to '''Properties'''
 +
# Select '''Internet Protocol Version 4 (TCP/IPv4)''' and choose '''Properties'''
 +
# Choose '''Obtain an IP address automatically''' and '''Obtain DNS server address automatically'''
  
 
Open a command prompt or bash terminal and run the following:
 
Open a command prompt or bash terminal and run the following:
Line 374: Line 349:
 
Login as root and run the following:
 
Login as root and run the following:
  
  beagle$ '''echo "nameserver 8.8.8.8" > /etc/resolv.conf'''
+
  bone$ '''echo "nameserver 8.8.8.8" > /etc/resolv.conf'''
  beagle$ '''echo "nameserver 8.8.8.4" >> /etc/resolv.conf'''
+
  bone$ '''echo "nameserver 8.8.8.4" >> /etc/resolv.conf'''
  beagle$ '''/sbin/route add default gw 192.168.7.1'''
+
  bone$ '''/sbin/route add default gw 192.168.7.1'''
  beagle$ '''ping google.com'''
+
  bone$ '''ping google.com'''
 +
 
 +
If 'ping:unknown host google.com' occurs, run this instead:
 +
 
 +
bone$ '''echo "nameserver 137.112.4.196" > /etc/resolv.conf'''
 +
bone$ '''/sbin/route add default gw 192.168.7.1'''
 +
bone$ '''ping google.com'''
  
Congratulations, you now have a connection to the Internet.
+
Congratulations, you now have a connection from your BeagleBone through your Linux host to the Internet.
  
 
{{YoderFoot}}
 
{{YoderFoot}}

Latest revision as of 05:54, 29 November 2023

thumb‎ Embedded Linux Class by Mark A. Yoder


3.8 Kernel

These instructions are for the 3.8 and newer kernels. EBC Exercise 02 Out-of-the-Box, Bone 3.2 Kernel has instructions for the 3.2 kernel.

Internet Connection to the Outside World

Once the Bone can connect to the host, the host can be used for forward requests from the Bone to the Internet. Follow the instructions below to set up your host and Bone so the bone can access the internet through your host.

Linux

Setting up VirtualBox

If you are running a virtual machine make sure the guest OS (Ubuntu) has captured the USB from the host OS (Windows). EBC_Exercise_01_Start_Here#The_Linux_host_computer shows how to install Guest Additions on VirtualBox. Once installed be sure to capture the USB by going to Devices:USB and select the Beagle. Then go to Devices:USB settings... Click on the Add icon on the right and check the Beagle. This will make it permanent.

See your networks with ip a

Run:

host$ ip a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 54:ee:75:19:8d:53 brd ff:ff:ff:ff:ff:ff
    inet 10.0.4.102/24 brd 10.0.4.255 scope global dynamic noprefixroute enp0s25
       valid_lft 84299sec preferred_lft 84299sec
    inet6 fe80::e6d0:8d85:4488:6b5f/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
5: wlp3s0: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 28:b2:bd:03:68:d0 brd ff:ff:ff:ff:ff:ff
6: gpd0: <POINTOPOINT,MULTICAST,NOARP> mtu 1400 qdisc fq_codel state DOWN group default qlen 500
    link/none 
    inet 137.112.193.14/32 scope global gpd0
       valid_lft forever preferred_lft forever
28: enx1cba8ca2ed6d: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 1c:ba:8c:a2:ed:6d brd ff:ff:ff:ff:ff:ff
    inet 192.168.6.1/24 brd 192.168.6.255 scope global dynamic noprefixroute enx1cba8ca2ed6d
       valid_lft 932sec preferred_lft 932sec
    inet6 fe80::3ad0:6711:a2ec:50f0/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
29: enx1cba8ca2ed6b: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UNKNOWN group default qlen 1000
    link/ether 1c:ba:8c:a2:ed:6b brd ff:ff:ff:ff:ff:ff
    inet 192.168.7.1/24 brd 192.168.7.255 scope global dynamic noprefixroute enx1cba8ca2ed6b
       valid_lft 1125sec preferred_lft 1125sec
    inet6 fe80::cd04:f44f:cf68:f98a/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever

Note the name associated with the local connection between you Linux host and the Internet. In my case it's enp0s25. We'll use it later.

ssh and changing the password

You'll see two new networks have appeared, enx1cba8ca2ed6d and enx1cba8ca2ed6b in my case. The IP address of your host is 192.168.7.1. There's a good chance the Bone is at 192.168.7.2. Try connecting to it. The default password is temppwd.

host$ ssh debian@192.168.7.2
bone$ 

You are now logged into the Bone through the network. This is much faster than the serial port (.115M vs. 100M) and supports many interesting network operations.

Note: If the ssh fails and you are running WSL, try following the instructions here https://forum.beagleboard.org/t/debian-12-x-major-changes-ncm-only-iwd-for-wifi/36176 to enable RNDIS.

Take a look around. What do you find?

Since everyone knows the default password, change it to something else.

bone$ passwd
Changing password for debian.
(current) UNIX password:
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully

The only problem is, the Beagle doesn't know how to access the Internet through the host. Get back to the host computer:

bone$ exit

Setting up shortcuts to make life easier

We'll be ssh'ing from the host to the bone often, here are some shortcuts I use so instead of typing ssh debian@192.168.7.2 and a password every time. I can enter ssh bone and no password.

First edit /etc/hosts and add a couple of lines.

host$ sudo nano /etc/hosts

You may use whatever editor you want. I suggest nano since it's easy to figure out. Add the following to the end of /etc/hosts and quit the editor.

192.168.7.2     bone
192.168.8.1     bone2

If you are running wsl you need to edit /etc/wsl.conf or else these changes will be overwritten.

host$ sudo nano /etc/wsl.conf

To stop the overwrite process, simply add the following then save and exit.

[network]
generateHosts = false

Now you can connect with

host$ ssh debian@bone

Let's make it so you don't have to enter debian. On your host computer, put the following in ~/.ssh/config (Note: ~ is a shortcut for your home directory.)

Host bone
  User debian
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no

Host bone2
  User debian
  UserKnownHostsFile /dev/null
  StrictHostKeyChecking no

These say that whenever you login to bone or bone2, login as debian. Now you can enter.

host$ ssh bone

One last thing, let's make it so you don't have to add a password. Back to your host.

host$ ssh-keygen

Accept all the defaults and then

host$ ssh-copy-id bone

Now all you have to enter is

host$ ssh bone

and no password is required. If you, especially virtual machine users, get an error says "sign_and_send_pubkey: signing failed: agent refused operation", you can solve this by entering

host$ ssh-add

which adds the private key identities to the authentication agent. Then you should be able to

host$ ssh bone

without problems.

Setting up a root login

By default the image we are running doesn't allow a root login. You can always sudo from debian, but sometimes it's nice to login as root. Here's how to setup root so you can login from your host without a password.

host$ ssh bone
bone$ sudo bash
root@bone# nano /etc/ssh/sshd_config

Search for the line

#PermitRootLogin prohibit-password

and change it to

PermitRootLogin yes

(The # symbol indicates a comment and must be removed in order for the setting to take effect.)

Save the file and quit the editor. Restart ssh so it will reread the file.

root@bone# systemctl restart sshd

And assign a password to root.

root@bone# passwd

Now open another window on your host computer and enter:

host$ ssh-copy-id root@bone

and enter the root password. Test it with:

host$ ssh root@bone

You should be connected without a password. Now go back to the Bone and turn off the root password access.

root@bone# nano /etc/ssh/sshd_config

Restore the line:

#PermitRootLogin prohibit-password

and restart sshd.

root@bone# systemctl restart sshd
root@bone# exit
bone$ exit

You should now be able to got back to your host computer and login as root on the bone without a password.

host$ ssh root@bone

You have access to your bone without passwords only from you host computer. Try it from another computer and see what happens.

Set Up Git

We need to run some files that are in the class git repository. We'll learn more about using git later. Here I'll just show you how to get the files. Here we are installing these files on your host computer, later we'll install them on your Beagle.

On my host computer I had to run

host$ sudo apt update
host$ sudo apt install git

Make Room for Files

(Note: the following should be done automatically the first time you reboot your bone. Try it, reboot and if you see your whole SD card you can skip to the next section.)

Check out bb-growpart and bb-resizefs on Bullseye.


Connect to your Beagle and see how much free disk space you have:

host$ ssh bone
bone$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            215M     0  215M   0% /dev
tmpfs            49M  1.6M   47M   4% /run
/dev/mmcblk0p1  7.4G  3.7G  3.4G  53% /
tmpfs           243M     0  243M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           243M     0  243M   0% /sys/fs/cgroup
tmpfs            49M     0   49M   0% /run/user/1000

/dev/mmcblk0p1 has some 7.4G and 3.4G is still available. You probably have just shy of 4G and not much available. What's going on here? You should have a least an 8G card, but 8G isn't showing up? It turns out the image you downloaded was for a 4G card, so it isn't set up to use you whole memory card. The solution is one command away.

bone$ /opt/scripts/tools/grow_partition.sh

This will grow your partition to fill your whole card. A reboot is necessary:

bone$ reboot

Once rebooted,

host$ ssh bone
bone$ df -h

and you should see plenty of disk space.

Get the Files

It only takes one command to pull down all the files.

host$ git clone https://github.com/MarkAYoder/BeagleBoard-exercises.git exercises --depth=1

(The whole repo is some 1013M. Using --depth=1 you only get the recent history and it only takes 200M.)

This will take a while since it's getting all the course files, including pdf files of the course PowerPoint.

Running ipMasquerade.sh

Now that the files are installed, run:

host$ cd exercises/setup
host$ ./ipMasquerade.sh enp0s25

Plug in for enp0s25 whatever is returned when you run ip a earlier. This will give you instructions on how to set up your host. Note: If you are using a wireless connection you should use

host$ ./ipMasquerade.sh wlp16s0

where wlp16s0 is what is returned by ip a for your wireless connection on your host.

Once ./ipMasquerade.sh has been run you can:

host$ ./firstssh.sh

Now you should have network access on the Bone.

bone$ ping -c2 google.com

You should see Google responding.

Congratulations! Your Beagle is now on the network through your host computer.

You will have to run ipMasquerade.sh only after rebooting your host computer and run firstssh.sh after rebooting your bone. Once firstssh has be run you should ssh from your host with the standard ssh command.

Troubleshooting

Unknown Host

If you get an unknown host response when attempting to ping google.com, and you are off campus, try pinging the Google DNS by IP address. Run:

bone$ ping 8.8.8.8

If you are on campus, run:

bone$ ping 137.112.5.28

If you now see responses by pinging a specific IP, it is possible that a firewall on your host computer is blocking the Beagle's access to the DNS when attempting to ping by domain name. On Ubuntu/Mint, run:

host$ sudo ufw disable
Firewall stopped and disabled on system startup

You should get a response, such as above, that the firewall will be disabled upon next startup. After saving anything important, restart your host through the start menu or run:

host$ reboot

Repeat this exercise and attempt to ping Google by domain name again. If you now receive responses, then the firewall was indeed the issue. Otherwise, the internet is your friend. Use your host computer to try and find a solution. Feel free to add solutions here when you find them

NetworkManager Issues

If you continue to have problems with firstssh.sh and receive errors regarding the network manager command line tool (nmcli) such as:

mv: cannot stat '/etc/resolv.conf'

or

nmcli failed, trying older 'list' instead of 'show'
nmncli failed again, giving up. . .

then you may have success with the following solution.

Access your bone with ssh bone and check to see which network interface is tethered to your host. It should be usb0, already assigned the ip address of 192.168.7.2. If so, simply enter the following in the command line:

bone$ route add default gw 192.168.7.1

Now return to your host machine and check what your internet facing interface is. It should be some eno interface for a wired connection or wlp interface for wireless. Your Bone should be on one of the usb ports, starting with enx and showing an ip address for your host machine of 192.168.7.1. The example commands below will use wlp in place of the internet facing interface and enx in place of the Bone interface.

host$ iptables --table nat --append POSTROUTING --out-interface wlp -j MASQUERADE
host$ iptables --append FORWARD --in-interface enx -j ACCEPT
host$ echo 1 > /proc/sys/net/ipv4/ip_forward

You should now ssh into your Bone and see if the routing change has worked. These commands are essentially what the ipMasquerade.sh and firstssh.sh scripts already do, but I started to encounter problems with them and had more success performing the operations manually.

OS X

I haven't checked these instructions this year. Please report your results and update if needed.

  1. go to System Preferences and select Network
  2. You should see RNDIS/...Gadget. This is the network connection to the Beagle. Select it
  3. Wait for the IP address 192.168.7.1 to appear
  4. Click Show All and select Sharing
  5. Select Internet Sharing
  6. Select RNDIS/Ethernet Gadget

In a terminal window connect to the serial port

host$ screen /dev/ttyusb*B 115200
bone$ udhcpc -i usb0
bone$ ping google.com

This is all nicely shown here in this silent YouTube movie.

Congratulations, you now have a connection from your BeagleBone to the Internet.

Windows 7

I haven't checked these either. Please report results and update if needed.

There are several ways of running ssh on Windows 7. Below are a couple of tools that you can use.

Environment Setup

You can either run ssh from a bash terminal (i.e. C:\Program Files\Git\Git Bash or C:\cygwin\Cygwin.bat), or you can add the bin directories to your path and run from the Windows command prompt (i.e. add C:\Program Files\Git\bin or C:\cygwin\bin to your path).

Note: Be careful adding multiple bin directories to your path

First time setup

  1. Run regedit
  2. Navigate to Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\Tcpip\Parameters
  3. Change IPEnableRouter from 0 to 1
  4. Close regedit
  5. Run services
  6. Make sure the following are set to Automatic and are started
    1. Routing and Remote Access
    2. Internet Connection Sharing (ICS)

Connecting to the Internet

After ejecting

  1. Navigate to Control Panel\Network and Internet\Network and Sharing Center\Change adapter settings
  2. Right click your wired/wireless internet connection and go to Properties
  3. Go to the Sharing tab
  4. Check the box to Allow other network users to connect through this computer's Internet connection
  5. Select your bone's local area connection for the Home networking connection (if you cannot choose the local area connection, turn your internet connection sharing off and then back on)
  6. Return to Change adapter settings
  7. Right click your Bone's internet connection and go to Properties
  8. Select Internet Protocol Version 4 (TCP/IPv4) and choose Properties
  9. Choose Obtain an IP address automatically and Obtain DNS server address automatically

Open a command prompt or bash terminal and run the following:

host$ ping 192.168.7.2

If this ping times out then disable and re-enable your bone's local area connection and try again. Once it works run the following:

host$ ssh root@192.168.7.2

Login as root and run the following:

bone$ echo "nameserver 8.8.8.8" > /etc/resolv.conf
bone$ echo "nameserver 8.8.8.4" >> /etc/resolv.conf
bone$ /sbin/route add default gw 192.168.7.1
bone$ ping google.com

If 'ping:unknown host google.com' occurs, run this instead:

bone$ echo "nameserver 137.112.4.196" > /etc/resolv.conf
bone$ /sbin/route add default gw 192.168.7.1
bone$ ping google.com

Congratulations, you now have a connection from your BeagleBone through your Linux host to the Internet.




thumb‎ Embedded Linux Class by Mark A. Yoder