"... and no one shall work for money, and no one shall work for fame; But each for the joy of the working, and each, in his separate star, shall draw the thing as he sees it, for the god of things as they are"

-Kipling

 

Networking Setup Connecting the Beaglebone Black to the Internet

Summary

This page describes how to configure a static IP address on a Beaglebone Black and the configuration of nameservers and other Internet networking options. This page focuses on a connection via the built in ethernet adapter - if you are interested in connecting the Beaglebone Black to the Internet via the USB cable, you might find the dedicated How To Connect a Beaglebone Black To The Internet Via USB page to be more useful.

This page is part of a series of web pages which describe how to install C# and Mono on the Beaglebone Black and also how to setup a useful remote compilation and debugging toolchain for it. This page is a pre-requisite for a following page which describes the procedure for installing Mono on the Beaglebone Black and the contents of this page are oriented towards that end result. Previous pages in this series describe the installation procedure for the Debian v3.08 Linux Armhf operating system on a micro SD card and a suitable hardware setup. The discussion below assumes the presence of that hardware setup and operating system configuration.

It should be noted that the current page is a revised edition of a previous page and it now focuses on the Beaglebone Black specific Debian v3.08 distribution newly available for download from the Beagleboard.org website. As of the time of this writing, the latest version available is Debian (BeagleBone, BeagleBone Black - 4GB SD) 2015-03-01 and all discussions on this page, and the subsequent series of pages, will reference that operating system. The previous version of this information focused on the generic Ubuntu armhf 14.04 distribution available from armhf.com the usage of which has now been made redundant by the release of the Beaglebone Black specific Debian 2015-03-01 version.

Setting up Basic Networking

After you boot off the micro SD card as described on the previous page, you may find that it takes a while for the Beaglebone Black to start the LXDE GUI (it might look like it is hung). It isn't actually hung, the delay of a minute or so is because the new installation is looking for a DHCP server to give it an IP address and if it cannot find one it will take a while to time out. If you are not going to connect the Beaglebone Black to the Internet you can comment out the line iface eth0 inet dhcp in the /etc/network/interfaces file to speed things up. However, as discussed below, you really do need to be connected to the Internet - at least initially. You are going to need an Internet connection for the next step when you upgrade all of the software you just installed and to obtain other packages.

The ethernet cable should be plugged into the Beaglebone Black's RJ45 ethernet port and the other end into an Internet connected LAN port. Test the Internet connection by using your Beaglebone Black connected USB keyboard/mouse and monitor to start up a shell prompt on the LXDE Window. Once you get the window open, issue the command ping 8.8.8.8 while logged into the Beaglebone Black. If you do not get a response then your Internet connection is not working. It may just be that you do not have a DHCP server on your network and hence have no automatically assigned IP address. In that case, the static ethernet configuration discussion below will get you going. If that does not work you'll need to debug the Internet connectivity before proceeding to the install of Mono and C#. Use the command ip addr show to see your IP address and attempt to ping that address from the Beaglebone Black and also from a remote PC and take all the other standard actions to debug this sort of thing.

As mentioned above, by default, when the Beaglebone Black first starts, it will try to get its IP address via DHCP. This is good in the sense that an Internet connection will probably be immediately operational, however, it is bad because it means the IP address can change each time you boot. This will make it awkward to ssh into the Beaglebone Black from the remote development PC because you will have to figure out which IP address it is using each time. Also, later on, you will want the IP address to remain unchanged (static) for when you configure networking to the Beaglebone Black as part of the remote compilation toolchain. You will also need to set up nameservers. For example, when logged into the Beaglebone Black, you will want to be able to issue the command ping google.com instead of ping 8.8.8.8 and have it work. To do this follow the sequence of steps below ...

Issue the command ip addr show | grep eth0 On my system it returned the line...

inet 192.168.1.102/24 brd 192.168.1.255 scope global eth0

The value 192.168.1.102 is the assigned IP address given to the Beaglebone Black by the network DHCP server. We might as well use that one for the static address since we are now pretty sure that it is not in use by anything else on the network. If you don't have a DHCP server which assigned the IP address you'll need to find out a suitable unused IP address. You can ask the network administrator for this or, if it is your personal local area network, find out the IP addresses of other devices on the same network and attempt to figure out an unused address using them.

Use the command (as root) nano /etc/network/interfaces to edit the interface definitions (make a copy of this file first). Comment out the line below which automatically gets the IP address via DHCP...

#iface eth0 inet dhcp

...and add the lines below which force it to be a static IP address. Note the nameserver lines below which set up Internet name resolution. The ones used in the example below are the Google public nameservers. You can certainly substitute other ones if you wish. The gateway IP address (192.168.1.254) in this example is the IP address of my side of the ISP's Internet hub - your gateway IP address will probably be different.

iface eth0 inet static 
        address 192.168.1.102 
        netmask 255.255.255.0 
        gateway 192.168.1.254 
        dns-nameservers 8.8.8.8 
        dns-nameservers 8.8.4.4 

Once the edits are completed, my /etc/network/interfaces file looked like the one below. Note that I also disabled the entire iface usb0 section because I did not want to be able to connect to a PC via the USB Ethernet/RNDIS gadget.

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback

# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.1.102
        netmask 255.255.255.0
        gateway 192.168.1.254
        dns-nameservers 8.8.8.8
        dns-nameservers 8.8.4.4
#iface eth0 inet dhcp
# Example to keep MAC address between reboots
#hwaddress ether DE:AD:BE:EF:CA:FE

# The secondary network interface
#auto eth1
#iface eth1 inet dhcp

# WiFi Example
#auto wlan0
#iface wlan0 inet dhcp
#    wpa-ssid "essid"
#    wpa-psk  "password"

# Ethernet/RNDIS gadget (g_ether)
# ... or on host side, usbnet and random hwaddr
# Note on some boards, usb0 is automaticly setup with an init script
#iface usb0 inet static
#    address 192.168.7.2
#    netmask 255.255.255.0
#    network 192.168.7.0
#    gateway 192.168.7.1

Reboot the Beaglebone Black by issuing the command reboot or by cycling the power and you should find, once it restarts, that the IP address is statically set to the value of 192.168.1.102 or whatever you entered. You should also find that you can successfully ping 192.168.1.102, ping 8.8.8.8 and also ping google.com. Also check that you can ssh (see below) into the Beaglebone Black from a remote PC using that IP address. In addition you should find that the date command will show that the system date is now set correctly since the startup routines that try to set that can now find a date and time server on the Internet. If any of these things are not working correctly, you really should correct them before moving on to the next steps.

Digression: Connecting using SSH Telnet Client

Telnet is basically a method of presenting a shell prompt from a remote device in a window on a local computer (in this case a Windows PC). Telnet itself is not used much anymore as it is pretty insecure and is disabled by default on nearly all new Linux installations. A similar mechanism called SSH (Secure SHell) is used in its place.

In order to use SSH to connect to the Beaglebone Black from a remote Linux machine you would simply start a shell prompt on that remote machine and enter a command like ssh 192.168.1.102 -l debian. Windows platforms do not have a "built in" ssh client so you'll you have to install an application that provides it. There are many such software programs – the most common of which is PuTTY. PuTTY is free and can be found on the website below

http://www.chiark.greenend.org.uk/~sgtatham/putty/

I'll not tell you how to install and configure PuTTY here – you can easily find out a lot of information on how to do that on the Internet. Once you get PuTTY installed and started you can connect to the IP address of the Beaglebone Black (192.168.1.102) using the main configuration panel (left image below). Once connected, you should see a window like the one on the right side below

    

The PUTTY Configuration and Terminal Windows

 

Don't be alarmed if the information you see on the screen is slightly different than that shown above. Each variant and distribution of Linux will probably look a bit different. They all operate mostly the same though – at least when you are at the novice level. Note that the name of the distribution we are using is displayed in this window (circled above in yellow) and this confirms we have booted off the new Debian 2015-03-01 version we installed on the micro SD card rather than default distribution in the Beaglebone Black's EMMC memory.

When you first connect to the Beaglebone Black the username will probably either be root (with a password of root) or debian and the password will probably be temppwd or debian. Lots of times the default login information is given to you on the page from which you downloaded the source image. In the above example, it also helpfully tells you the default username and password in the login banner right on the screen. You should always change the password by using the passwd command (just type passwd at the prompt). You should also change the root password from its defaults with a command like sudo passwd root.

Finish the Installation and Get the Latest Packages

At this point the Beaglebone Black has booted and has a static IP address and working nameservers. Now you need to upgrade the installation. In order to save space the distribution you downloaded and installed only has the basic things necessary to get it to start. You need to get fully upgraded. This is not a problem if your Beaglebone Black is connected to the Internet. I have no idea how you might do it if you aren't and so will not discuss that situation here. To upgrade just issue both the following commands (as root)...

apt-get update
...and then...
apt-get upgrade
...to get everything sorted out. This will take some time (30 minutes) and you will see an enormous amount of text scrolling by on the screen. There were some warnings (but no errors) when I did this which I just ignored and nothing bad seemed to come of it.

Install Mono

You are now ready to install Mono (the C# compiler). However, that procedure is described on the next page in this series.

License

The contents of this web page are provided "as is" without any warranty of any kind and without any claim to accuracy. Please be aware that the information provided may be out-of-date, incomplete, erroneous or simply unsuitable for your purposes. Any use you make of the information is entirely at your discretion and any consequences of that use are entirely your responsibility. All source code is provided under the terms of the MIT License.