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

From eLinux.org
Jump to: navigation, search
m
m (update debian and password)
Line 3: Line 3:
  
 
{{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.
 
{{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.
 
== Getting Started ==
 
We'll be running the 3.8 kernel, check out these [http://beagleboard.org/Getting%20Started instructions] for getting started.  Then come back here to get your network set up.
 
  
 
== Internet Connection ==
 
== Internet Connection ==
  
One of the slickest features of the Bone is its ability to access the Internet through the USB (tether) connection. You should have already used it following the instructions above. Below shows how to set up your host and Bone so the bone can access the internet through your host.
+
One of the slickest features of the Bone is its ability to access the Internet through the USB (tether) connection. Plug a microUSB cable into your bone and plug  the other end into your host computer and wait for the Bone to boot up. Once the lights settle down to a heartbeat pattern, folow the instructions below to set up your host and Bone so the bone can access the internet through your host.
  
 
=== Linux ===
 
=== Linux ===
Line 16: Line 13:
  
 
  host$ '''ifconfig'''
 
  host$ '''ifconfig'''
  eth0    Link encap:Ethernet  HWaddr 00:18:8b:72:b8:c2  
+
  ens1      Link encap:Ethernet  HWaddr 00:1a:4b:58:f7:4b  
           inet addr:137.112.41.109 Bcast:137.112.41.255  Mask:255.255.255.0
+
           inet addr:137.112.41.36 Bcast:10.0.4.255  Mask:255.255.255.0
           inet6 addr: fe80::218:8bff:fe72:b8c2/64 Scope:Link
+
           inet6 addr: fe80::b6d7:76a6:e870:e98f/64 Scope:Link
 
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:8481193 errors:0 dropped:0 overruns:0 frame:0
+
           RX packets:113337 errors:0 dropped:1 overruns:0 frame:0
           TX packets:1871287 errors:0 dropped:0 overruns:0 carrier:0
+
           TX packets:76269 errors:0 dropped:0 overruns:0 carrier:0
 
           collisions:0 txqueuelen:1000  
 
           collisions:0 txqueuelen:1000  
           RX bytes:3172154531 (3.1 GB)  TX bytes:203188180 (203.1 MB)
+
           RX bytes:131750476 (131.7 MB)  TX bytes:9701999 (9.7 MB)
           Interrupt:19
+
           Interrupt:16
 
   
 
   
  eth4    Link encap:Ethernet  HWaddr d4:94:a1:39:ff:ff  
+
  enxec1127bf0841 Link encap:Ethernet  HWaddr ec:11:27:bf:08:41  
 
           inet addr:192.168.7.1  Bcast:192.168.7.3  Mask:255.255.255.252
 
           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
+
           inet6 addr: fe80::a875:1dfb:9b97:d049/64 Scope:Link
 +
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 +
          RX packets:1296 errors:0 dropped:0 overruns:0 frame:0
 +
          TX packets:1862 errors:0 dropped:0 overruns:0 carrier:0
 +
          collisions:0 txqueuelen:1000
 +
          RX bytes:410669 (410.6 KB)  TX bytes:367011 (367.0 KB)
 +
 +
enxec1127bf0844 Link encap:Ethernet  HWaddr ec:11:27:bf:08:44 
 +
          inet addr:192.168.6.1  Bcast:192.168.6.3  Mask:255.255.255.252
 +
          inet6 addr: fe80::9bbb:428a:70a0:6cc7/64 Scope:Link
 
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
 
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:8 errors:0 dropped:0 overruns:0 frame:0
+
           RX packets:479 errors:0 dropped:0 overruns:0 frame:0
           TX packets:6 errors:0 dropped:0 overruns:0 carrier:0
+
           TX packets:788 errors:0 dropped:0 overruns:0 carrier:0
 
           collisions:0 txqueuelen:1000  
 
           collisions:0 txqueuelen:1000  
           RX bytes:2775 (2.7 KB)  TX bytes:1234 (1.2 KB)
+
           RX bytes:258714 (258.7 KB)  TX bytes:109717 (109.7 KB)
 
   
 
   
  lo       Link encap:Local Loopback   
+
  lo       Link encap:Local Loopback   
 
           inet addr:127.0.0.1  Mask:255.0.0.0
 
           inet addr:127.0.0.1  Mask:255.0.0.0
 
           inet6 addr: ::1/128 Scope:Host
 
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:16436 Metric:1
+
           UP LOOPBACK RUNNING  MTU:65536 Metric:1
           RX packets:37315 errors:0 dropped:0 overruns:0 frame:0
+
           RX packets:2303 errors:0 dropped:0 overruns:0 frame:0
           TX packets:37315 errors:0 dropped:0 overruns:0 carrier:0
+
           TX packets:2303 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:0
+
           collisions:0 txqueuelen:1
           RX bytes:3665320 (3.6 MB)  TX bytes:3665320 (3.6 MB)
+
           RX bytes:203157 (203.1 KB)  TX bytes:203157 (203.1 KB)
  
 
==== ssh ====
 
==== ssh ====
You'll see a new network has appeared, '''eth4''' 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.
+
You'll see two new networks have appeared, '''enxec1127bf0841'''  and '''enxec1127bf0844'''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 -X root@192.168.7.2'''
+
  host$ '''ssh debian@192.168.7.2'''
 
  bone$  
 
  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.  The only problem is, the Beagle doesn't know how to access the Internet through the host. Get back to the host computer:
 
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.  The only problem is, the Beagle doesn't know how to access the Internet through the host. Get back to the host computer:

Revision as of 11:56, 2 August 2017

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

One of the slickest features of the Bone is its ability to access the Internet through the USB (tether) connection. Plug a microUSB cable into your bone and plug the other end into your host computer and wait for the Bone to boot up. Once the lights settle down to a heartbeat pattern, folow the instructions below to set up your host and Bone so the bone can access the internet through your host.

Linux

ifconfig

Run:

host$ ifconfig
ens1      Link encap:Ethernet  HWaddr 00:1a:4b:58:f7:4b  
         inet addr:137.112.41.36  Bcast:10.0.4.255  Mask:255.255.255.0
         inet6 addr: fe80::b6d7:76a6:e870:e98f/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:113337 errors:0 dropped:1 overruns:0 frame:0
         TX packets:76269 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:131750476 (131.7 MB)  TX bytes:9701999 (9.7 MB)
         Interrupt:16 

enxec1127bf0841 Link encap:Ethernet  HWaddr ec:11:27:bf:08:41  
         inet addr:192.168.7.1  Bcast:192.168.7.3  Mask:255.255.255.252
         inet6 addr: fe80::a875:1dfb:9b97:d049/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:1296 errors:0 dropped:0 overruns:0 frame:0
         TX packets:1862 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:410669 (410.6 KB)  TX bytes:367011 (367.0 KB)

enxec1127bf0844 Link encap:Ethernet  HWaddr ec:11:27:bf:08:44  
         inet addr:192.168.6.1  Bcast:192.168.6.3  Mask:255.255.255.252
         inet6 addr: fe80::9bbb:428a:70a0:6cc7/64 Scope:Link
         UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
         RX packets:479 errors:0 dropped:0 overruns:0 frame:0
         TX packets:788 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1000 
         RX bytes:258714 (258.7 KB)  TX bytes:109717 (109.7 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:65536  Metric:1
         RX packets:2303 errors:0 dropped:0 overruns:0 frame:0
         TX packets:2303 errors:0 dropped:0 overruns:0 carrier:0
         collisions:0 txqueuelen:1 
         RX bytes:203157 (203.1 KB)  TX bytes:203157 (203.1 KB)

ssh

You'll see two new networks have appeared, enxec1127bf0841 and enxec1127bf0844in 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. 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

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$ apt-get install git

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 550M. Using --depth=1 you only get the recent history and it only takes 190M.)

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 eth0

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 wlan0

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.

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

OSX

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