-Kipling
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 Armhf operating system on a MicroSD 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 9.5 2018-10-07 4GB SD LXQT Debian distribution available for download from the Beagleboard.org website.
After you boot off the MicroSD 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 may 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.
Many Linux distributions use a connection manager called connman
. It seems connman
can override the /etc/network/interfaces
settings and use its own. By default it will try to use DHCP to get a dynamic IP address. However, it also seems to store the last dynamic IP address it received and will use that if it cannot find a suitable IP address via DHCP.
This problem manifested itself when I changed the network configuration. All of a sudden a BBB previously connecting flawlessly for years was not available on the 192.168.1.102
IP address. It turns out that what I thought was a static IP address due to the configuration of the interfaces
file was actually dynamic because the router was just remembering that address and handing it out via DHCP each time the BBB booted. This went on for years until
the network change and, of course, the new router knew nothing about the old IP address and just handed out a random IP address to the BBB thus rendering it unreachable. Taking the router off the network caused connman
to boot the BBB with some ancient IP it address it had previously received via DHCP - most decidedly not 192.168.1.102
.
To resolve this problem you either need to ininstall connman
or to configure connman
to use a static IP address. This post from RobertCNelson lists these options. A more detailed discussion
of this problem and its resolution can be found in this forum post by the user wBB (thank you both!).
The upshot is that I chose the option of configuring connman
and running the command below (as root) solved the problem completely.
connmanctl config ethernet_1cba8ca33352_cable --ipv4 manual 192.168.1.102 255.255.255.0 192.168.1.254 --nameservers 8.8.8.8
Note that the ethernet_1cba8ca33352_cable
part of the command is the ethernet port on my BBB. Yours will have a different name. You can find it by looking in the connman
configuration directory. This directory is probably /var/lib/connman
.
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
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 version of the distribution we are using is displayed in this window if we type the cat /etc/debian_version command and this confirms we have booted off the new Debian 9.5 2018-10-07 version we installed on the MicroSD card rather than default distribution in the Beaglebone Black's eMMC memory.
When you first connect to the Beaglebone Black the username will probably be
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. 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
. Note that you are unlikely to be allowed
to login as root
from SSH. Virtually no modern Linux installations will permit this. If you need to be root
then login
as debian
(or some other user) and use the sudo -s
command to change over.
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.
You are now ready to install Mono (the C# compiler). However, that procedure is described on the next page in this series.
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.