Enabling masquerading

NOTE: On Centos the Firewall graphical interface doesn't seem to work properly, which means that you have to modify a settings file instead. You can perform the same settings change on other Linuxes, i.e. Fedora and others, that run firewalld.

for Centos edit the /etc/firewalld/zones/public.xml

<?xmlversion="1.0"encoding="utf-8"?><zone><short>Public</short><description>For use in public areas. You do not trust the other computers on n
etworks to not harm your computer. Only selected incoming connections are accepte
d.</description><servicename="dhcpv6-client"/><servicename="ssh"/><portprotocol="tcp"port="22"/></zone>

add just before the </zone> this line:

<masquerade/>

Then to reload the settings perform

$] systemctl restart firewalld.service

If you're running Windows Derrek Molloy has some advices on this page.

Prepare the BBB

On the BBB, in the /root directory, create this file and make it executable

#!/bin/bash# # Author : Klaus Kolle# Date : 2016 02 22# Purpose: Establishing connection to the Internet# and set the clock, which has no battery backup#echo"Starting the Internet-over-USB script"## Add a default gateway /sbin/route add default gw 192.168.7.1
grep-q 8.8.8.8 /etc/resolv.conf
if["$?"-ne"0"]; thenecho"nameserver 8.8.8.8">>/etc/resolv.conf
fi## Test for network availabilitywhile :
doping-c5-w10 192.168.7.1
if[$?-eq0]; thenbreakfidone## Now we should be ready to set the clock from the net/usr/sbin/ntpdate -b-s-u dk.pool.ntp.org
dateecho"End of the settings script"

At first login on the BBB execute this script as root (or use sudo).

Automating the script

You may want to set this script up so it will be executed at boot time. In order to do this you'll have to setup a boot script in /etc/init.d - you may want to call it internetOverUSB. Enter ths into the script.