It is rather easy to get access to the whole internet over the USB interface cable provided that your laptop/PC has internet access.

It is rather easy to get access to the whole internet over the USB interface cable provided that your laptop/PC has internet access.

+

+

==DNS on Aarhus University==

+

+

'''IMPORTANT'''

+

+

The original scripts below contains usage of Google's public DNS servers (at ipaddress 8.8.8.8). AU IT has decided to block traffic on port 53 - the port used for DNS lookups. So the only available DNS serveres, when you are attached to a AU network, is the DNS servers that AU IT provides.

+

+

I've experienced over the years that the IP addresses of the DNS servers changes without I get any notice.

+

+

Therefore before filling in the scripts below you'll have to lookup the avilable DNS servers.

+

+

On linux execute this command:

+

<source lang=bash>

+

$] cat /etc/resolv.conf

+

# Generated by NetworkManager

+

search bss.client.au.dk eduroam.net.au.dk ase.au.dk

+

nameserver 10.83.252.10

+

nameserver 10.83.16.53

+

nameserver 10.88.1.95

+

</source>

+

+

On Windows start the Powershell and execute:

+

<source lang=bash>

+

...:\> ipconfig /all

+

</source>

+

+

look for '''DNS Servers'''

+

DNS Servers . . . . . . . . . . . : 10.83.252.10

+

10.83.16.53

+

10.88.1.95

+

+

Be aware that the ipaddresses above may be different when you run the command.

+

+

Pick one of the ipadresses and substitute 8.8.8.8 with it in the scripts shown below.

+

+

If you plan to use your BBB at home or elsewhere outside the AU network you may leave the '''nameserver 8.8.8.8''' line in the scripts and just add another line with one or two of the ipadresses found above.

==Enabling masquerading==

==Enabling masquerading==

Line 5:

Line 41:

If you're running '''Linux''' you can follow these [https://github.com/anujdeshpande/BBB-workshop instructions].

If you're running '''Linux''' you can follow these [https://github.com/anujdeshpande/BBB-workshop instructions].

+

+

===Centos / Fedora The manual way===

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.

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.

Line 13:

Line 51:

<zone>

<zone>

<short>Public</short>

<short>Public</short>

−

<description>For use in public areas. You do not trust the other computers on n

+

<description>For use in public areas. You do not trust the other computers on networks to not harm your computer. Only selected incoming connections are accepted.</description>

−

etworks to not harm your computer. Only selected incoming connections are accepte

+

−

d.</description>

+

<service name="dhcpv6-client"/>

<service name="dhcpv6-client"/>

<service name="ssh"/>

<service name="ssh"/>

Line 34:

Line 70:

==Prepare the BBB==

==Prepare the BBB==

−

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

+

As root on the BBB, in the '''/root/bin''' directory, create a file named '''internetOverUSB''' and make it executable

<source lang=bash>

<source lang=bash>

#!/bin/bash

#!/bin/bash

Line 50:

Line 86:

grep -q 8.8.8.8 /etc/resolv.conf

grep -q 8.8.8.8 /etc/resolv.conf

if [ "$?" -ne "0" ]; then

if [ "$?" -ne "0" ]; then

+

echo "nameserver 10.83.16.53" >> /etc/resolv.conf

echo "nameserver 8.8.8.8" >> /etc/resolv.conf

echo "nameserver 8.8.8.8" >> /etc/resolv.conf

fi

fi

Line 68:

Line 105:

</source>

</source>

+

'''NOTICE: If your are using e.g. PocketBeagle the IP address above shall be 192.168.6.1'''

+

+

To make the file executable execute this command:

+

+

<source lang=bash>

+

$] chmod u+x internetOverUSB

+

</source>

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

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

Line 89:

Line 133:

start)

start)

sleep 20

sleep 20

−

/root/internetOverUSB

+

/root/bin/internetOverUSB

;;

;;

stop)

stop)

Line 115:

Line 159:

Try to reboot and login again. Check that the date now is correct. If not debug your scripts.

Try to reboot and login again. Check that the date now is correct. If not debug your scripts.

+

+

==Challenges==

+

+

Different operating system gives different problems and solutions.

+

+

===Debian/Mint===

+

+

Flemming Christensen provided this guide to Debian/Mint - it may be working on other Debian based distributions like Ubuntu, etc.

+

+

To setup internet over usb from Linux Mint to BeagleBone Black "Debian OS" execute this on the BBB.

+

+

<source lang=bash>

+

]$ sudo ufw disable

+

]$ sudo apt-get iptables

+

]$ sudo iptables -F “clean iptables rules”

+

]$/sbin/route add default gw 192.168.7.1

+

]$ echo "nameserver 8.8.8.8" >> /etc/resolv.conf

+

</source>

+

+

The last two lines are part of the script below.

+

+

On the Linux Mint host from which you want to route:

+

+

<source lang=bash>

+

]$ sudo iptables -A POSTROUTING -t nat -j MASQUERADE

+

]$ sudo echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward > /dev/null

+

</source>

+

+

Now on the BBB:

+

+

<source lang=bash>

+

]$ ping d.dk

+

]$ ping google.dk

+

</source>

+

+

If this dosen't work, try allowing this in the firewall via the terminal.

+

+

<source lang=bash>

+

]$ sudo ufw allow 192.168.7.2/22

+

</source>

+

+

+

===Windows===

+

+

If your host OS is Windows you may run into problems.

+

+

Sometimes Windows causes problems letting the network packages go all the way through to the Internet from the BBB via the Centos virtual PC.

+

+

You may try these advices in order to overcome the challenges.

+

+

First unplug your BBB.

+

+

Second Shut-off you virtual Centos.

+

+

Third go to VirtualBox settings for the virtual machine and select Network. Ensure that you use NAT as shown in this picture

+

+

[[File:VirtualBox.png|600 px]]

+

+

Fourth plug in your BBB and wait until it has booted completely. In VirtualBox settings switch to the USB settings and add by clicking on the +-button to the right your BeagleBone, which can have one of several names - for instance I've met Circuitco BBB and BeagleBoard.org BBB.

+

+

[[File:VirtualBox1.png|600 px]]

+

+

Finally unplug the BBB and reboot Windows. Then start the virtual Centos and when it is up running plug in the BBB and observe that it, after the booting sequence has completed, announces it self in the Centos virtual PC, i.e. the USB storage is available and the network interface is working.

+

+

==Speed up the login process==

+

Whenever a host tries to login on the BBB, the software running will try to lookup a hostname and an IP address using the DNS system. But sometimes, this can delay the login considerably. Fix it using this [http://klaus.ede.hih.au.dk/index.php/Linux_hints#Speed_up_the_SSH_login hint]

Latest revision as of 10:15, 1 May 2018

It is rather easy to get access to the whole internet over the USB interface cable provided that your laptop/PC has internet access.

Contents

DNS on Aarhus University

IMPORTANT

The original scripts below contains usage of Google's public DNS servers (at ipaddress 8.8.8.8). AU IT has decided to block traffic on port 53 - the port used for DNS lookups. So the only available DNS serveres, when you are attached to a AU network, is the DNS servers that AU IT provides.

I've experienced over the years that the IP addresses of the DNS servers changes without I get any notice.

Therefore before filling in the scripts below you'll have to lookup the avilable DNS servers.

Be aware that the ipaddresses above may be different when you run the command.

Pick one of the ipadresses and substitute 8.8.8.8 with it in the scripts shown below.

If you plan to use your BBB at home or elsewhere outside the AU network you may leave the nameserver 8.8.8.8 line in the scripts and just add another line with one or two of the ipadresses found above.

Enabling masquerading

Masquerading is forwarding the Internet to the BBB over the "USB network".

Centos / Fedora The manual way

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 networks to not harm your computer. Only selected incoming connections are accepted.</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

As root on the BBB, in the /root/bin directory, create a file named internetOverUSB and make it executable

NOTICE: If your are using e.g. PocketBeagle the IP address above shall be 192.168.6.1

To make the file executable execute this command:

$]chmod u+x internetOverUSB

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.

If this dosen't work, try allowing this in the firewall via the terminal.

]$ sudo ufw allow 192.168.7.2/22

Windows

If your host OS is Windows you may run into problems.

Sometimes Windows causes problems letting the network packages go all the way through to the Internet from the BBB via the Centos virtual PC.

You may try these advices in order to overcome the challenges.

First unplug your BBB.

Second Shut-off you virtual Centos.

Third go to VirtualBox settings for the virtual machine and select Network. Ensure that you use NAT as shown in this picture

Fourth plug in your BBB and wait until it has booted completely. In VirtualBox settings switch to the USB settings and add by clicking on the +-button to the right your BeagleBone, which can have one of several names - for instance I've met Circuitco BBB and BeagleBoard.org BBB.

Finally unplug the BBB and reboot Windows. Then start the virtual Centos and when it is up running plug in the BBB and observe that it, after the booting sequence has completed, announces it self in the Centos virtual PC, i.e. the USB storage is available and the network interface is working.

Speed up the login process

Whenever a host tries to login on the BBB, the software running will try to lookup a hostname and an IP address using the DNS system. But sometimes, this can delay the login considerably. Fix it using this hint