Differences
This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
| network_protocol_programming_lab:2_2_access_general [2022/04/13 16:18] – created fangenoorth | network_protocol_programming_lab:2_2_access_general [2022/04/18 17:37] (current) – [Internet Connection sharing via USB] fangenoorth | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== 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 '' | ||
| + | |||
| + | 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 [[network_protocol_programming_lab: | ||
| + | |||
| + | ===== 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: | ||
| + | |||
| + | <code bash> | ||
| + | ssh debian@< | ||
| + | </ | ||
| + | |||
| + | 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 '' | ||
| + | |||
| + | If your host PC supports [[https:// | ||
| + | |||
| + | |||
| + | ===== 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 ''/ | ||
| + | |||
| + | The serial port doesn' | ||
| + | |||
| + | If no serial port appears, consult the [[network_protocol_programming_lab: | ||
| + | |||
| + | |||
| + | ===== 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 '' | ||
| + | |||
| + | Your host PC should automatically fetch an IP address from the BeagleBone via the DHCP Server which the BeagleBone provides. This should be either // | ||
| + | |||
| + | 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 ''/ | ||
| + | |||
| + | <code bash> | ||
| + | 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 | ||
| + | USB1_SUBNET=192.168.6 | ||
| + | </ | ||
| + | |||
| + | 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 '' | ||
| + | |||
| + | A tutorial on how to set this up on a Windows host can be found [[https:// | ||
| + | |||
| + | === Connection sharing on a Linux host === | ||
| + | |||
| + | Run the following commands as '' | ||
| + | |||
| + | <code bash> | ||
| + | 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 < | ||
| + | </ | ||
| + | |||
| + | 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 '' | ||
| + | |||
| + | <code bash> | ||
| + | ip route add default via 192.168.6.1 | ||
| + | echo " | ||
| + | </ | ||
| + | |||
| + | 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 '' | ||
| + | |||
| + | Note that these settings are not persistent across reboots. You have to enter all commands, on your host as well as on the BeagleBones, | ||
