Accessing the BeagleBone Black

The default username to log onto the BeagleBone Black is debian and the default password is temppwd. You might want to change these later with the passwd command executed as the debian user (not root).

Now we need a way to access our freshly installed Debian OS. There are three possible ways to do so:

  • Access via SSH through Ethernet
  • Access via Serial Port
  • Access via SSH through USB

Access through Ethernet is the recommended option as it gives you the best system stability as well as best performance. However we will briefly present all options, as some options aren't always viable. If accessing the BeagleBone Black via USB it might be required that you install the correct drivers. However recent OS versions should already include those by default. Driver installation instructions can be found here.

Access via SSH through Ethernet

If you connect the BeagleBone Black to a Router (or in general a network where a DHCP server is available) it will automatically fetch an IP address from that DHCP server. Using this IP you can connect to the BeagleBone Black via SSH:

ssh debian@<IP address>

On Linux and Mac OS a ssh client is already included. On recent Windows versions ssh is also shipped. To verify, simply open a PowerShell and enter ssh. If you get an error, you have to install a separate ssh client. A popular choice is putty which can be downloaded from here.

If your host PC supports mDNS the BegleBone will also be reachable via the hostname beaglebone.local (use this instead of the IP address). If you operate multiple BeagleBones in your local network they will be available as beaglebone-2.local and so on.

Access via Serial Port

Upon connecting the BeagleBone Black via the mini USB port to your host PC, it should automatically register a serial port. Under Linux this will show up as a device like /dev/ttyACM0 or /dev/ttyUSB0. In Windows it will be visible as a COM Port, which should be shown in the Device Manager. You can connect to that serial port with any serial terminal program like minicom for Linux or again putty for Windows. Use a baudrate of 115200.

The serial port doesn't perform very well (the terminal size is rather limited, no colors, etc…), so it's mostly useful as a backup if you mess up your IP configuration for example.

If no serial port appears, consult the driver setup page or use ethernet based access.

Access via SSH through USB

Upon connecting the BeagleBone Black via the mini USB port to your host PC, it should also create one or two virtual ethernet adapters. One of these is meant to be used for Linux and Mac OS hosts and the other one for Windows hosts. You can verify that these adapters have been created, using the ip link command in Linux and for Windows you can check the Network and Sharing Center in the Control Panel. If they are not created, consult the driver setup page or use ethernet based access.

Your host PC should automatically fetch an IP address from the BeagleBone via the DHCP Server which the BeagleBone provides. This should be either 192.168.6.1 for Linux and Mac OS hosts or 192.168.7.1 for Windows hosts. If you see both, simply chose the one that matches your OS. The BeagleBone assigns itself an IP address with the last octet being 2, so 192.168.6.2 or 192.168.7.2 respectively.

Now you can connect to the BeagleBone via ssh as described above, using one of the IP addresses ending in 2.

This option is preferable over the method via serial port, as it uses SSH and thus offers better terminal capabilities. It also allows you to transfer files between your host and the BeagleBone as well as share your hosts internet connection with the BeagleBone through the USB connection. The procedure to setup the internet connection sharing is described below.

Connecting multiple BeagleBones via USB

If you connect two or more BeagleBones via USB to your host PC and try to connect to them via SSH through the USB connection, you will run into issues, as both BeagleBones will try to assign themselves and your host the same IP address. If you still want to use SSH via USB, you need to change the IP addresses of at least one BeagleBone, so that there are no IP collisions. This can easily be done by changing one file on the BeagleBone.

To do so, connect to the BeagleBone Black with one of the methods described above and edit the file /etc/default/bb-boot as root. Edit the respective lines as depicted below to instruct the BeagleBone to assign different IP addresses:

USB0_ADDRESS=192.168.7.2 -> USB0_ADDRESS=192.168.9.2
USB1_ADDRESS=192.168.6.2 -> USB1_ADDRESS=192.168.8.2
USB0_SUBNET=192.168.7    -> USB0_SUBNET=192.168.9
USB1_SUBNET=192.168.6    -> USB1_SUBNET=192.168.8

Take note of the changed IP addresses, reboot your BeagleBone and check if the IP addresses have changed. Now you can connect to one BeagleBone using the old IP address and to the other one using the changed IP address.

Internet Connection sharing via USB

It is possible to share the internet connection (e.g. via ethernet or WiFi) with the BeagleBone Black. On Linux this works consistently and also with multiple BeagleBones connected at the same time. On Windows it works a little less consistent and so far we could only make it work with one BeagleBone at a time (you can SSH into both BeagleBones at the same time, but only one of them will be able to access the internet). This setup might be useful for you if you are unable to plug the BeagleBones into a router via ethernet. Note that the connection speed will be rather limited, usually around 100 kbit/s.

A tutorial on how to set this up on a Windows host can be found here.

Connection sharing on a Linux host

Run the following commands as root on your laptop/desktop. The name of the interfaces can be found out by executing the ip link command on your host PC, replace the placeholders in the commands with your actual interface names. Note that the last command needs to be run as often as many BeagleBones you wish to share your internet connection to (e.g. twice for two BeagleBones).

sysctl net.ipv4.ip_forward=1
iptables --table nat --append POSTROUTING --out-interface <host interface to be shared> -j MASQUERADE
iptables --append FORWARD --in-interface <interface of BBB> -j ACCEPT  

These commands enable forwarding of IP packets between the interfaces, where your host PC does NAT.

Now we need to configure the forwarding on the BeagleBones. So enter the following as root:

ip route add default via 192.168.6.1
echo "nameserver 8.8.8.8" >> /etc/resolv.conf

The first commands sets a default route, so that all outgoing IP packets get sent to the host PC. Note that you might have to change the third octet of the IP address if you have connected multiple BeagleBones via USB and changed their IP addresses earlier. The second command configures a DNS server to enable the BeagleBones to resolve domain names.

Now the BeagleBone(s) should be connected to the internet. You can verify this by executing ping google.com or similar.

Note that these settings are not persistent across reboots. You have to enter all commands, on your host as well as on the BeagleBones, again after a reboot.

network_protocol_programming_lab/2_2_access_general.txt · Last modified: 2022/04/18 17:37 by fangenoorth
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0