Question

I am trying to share the internet with the Beaglebone Black from my laptop. Here is what I tried till now-

  1. I connected Beaglebone Black to my laptop running Windows 8 via USB cable. Then, I went to network and sharing center. Then, the network which I want to share, I shared it with the Beaglebone(It says Local Area Connection). Now, I went to the Gate one SSH on Beaglebone and wrote - "ping www.google.com". But it said "Unknown Host".

  2. Now, since the above didn't work, I connected the Beaglebone Black with the standard ethernet cable and again tried sharing my network, but it still didn't work.

Here is what I am trying to do- If I am able to connect to internet, I want to set up VNC server and through that I want to load the GUI of linux on my laptop.

Any help will be greatly appreciated. If there is any other method to accomplish this, please tell me about it. I have tried most of the tutorials on the internet, but didn't succeed.

Was it helpful?

Solution

Here is the detailed answer, after long long waiting I finally figured out how to share internet on BBB. This question is being seen at least 10 times everyday so I though I should answer it by my own. (Also SO gave me Popular question badge for this!)

First thing I tried was:

I connected the BBB(running angstrom) to laptop (running windows 8). The laptop recognized the device and I was able to SSH it through putty.

Now, I tried to ping my computer back whose IP address is 192.168.7.1 .. This step never worked for me, my BBB was never able to ping my computer back but, I was able to ping the beaglebone itself through the provided IP that is 192.168.7.2 (which is obvious)

I searched everywhere on internet and did everything to overcome this glitch such as:

I made the default gateway in BBB to 192.168.7.1

/sbin/route add default gw 192.168.7.1

but that also didn't worked.

I previously thought that it is necessary for me to ping 192.168.7.1 in order to get the internet on BBB.

Since nothing was working I decided to skip this step.

I simply connected the BBB, and then went to network and sharing center in windows 8 and from there, I shared the internet connection from my wifi connection to the beaglebone.

As you will do this, you will see that BB will loose its connection from the putty (if you started putty before network sharing), This is because computer assigns an IP to the BB which you have to change to 'Obtain the IP automatially'

To do this right click and go to properties of the BB connection and then from the list select the IPV4 tcp/IP and go to its properties. In that, you will see the option 'Obtain IP automatically'

Now again start putty (as previous connection will get terminated) and you will see that BB is able to connect.

Now simply add the default gateway as I showed above and then you will be able to ping 8.8.8.8 or any other IP address. Now, simply add the nameserver like this:

cd /etc
more resolv.conf
nano resolv.conf 

and add this line below nameserver 127.0.0.1

nameserver 8.8.8.8

and save it, you will be able to ping google.com.

Now comes the VNC server part. For that case also I was wrong. To connect to VNC server you do not need internet connection on the BBB. Yes, you will need that for installing the VNC server on it but not afterwards. Once it is installed, you have to simple do this in BB:

x11vnc -bg -o %HOME/.x11vnc.log.%VNCDISPLAY -auth /var/run/gdm/auth-for-gdm*/database -display :0  -forever

and press enter and BB will reply with VNC started at port 5900

Thats it, now comeback to windows and start VNC server, add the address 192.168.7.2 and you can see the GUI on the screen. I am also able surf internet on the beaglebone.

Thank you for the support and if I am wrong here in my question then please notify me. Also if you have any doubt, refer to this awesome video my derek molloy: He has explained it very well and remember to skip the step of pinging back 192.168.7.1 if it is not working.

I have not yet figured it out. I will edit the answer once I get it.

OTHER TIPS

1) On your Beaglebone:

sudo su

ifconfig usb0 192.168.7.2

route add default gw 192.168.7.1

2) Now share the network and make sure your pc's ip is 192.168.7.1 after you do

connect beaglebone black to router via ethernet now use adb tcpip 5555
adb connect bbb_ip:5555 then use adb shell

The problem you're facing is of resolving nameservers. If you're able to access the device through SSH (using PuTTy, for example), then you can provide it internet too- but the device needs to know where to look for.

The BeagleBone Black has a utility called Connman that manages its connections.

/usr/lib/connman/test has functions related to it.

Use ./set-ipv4-method in there to set different values. Be sure to set the nameservers right. If in doubt, use 8.8.8.8 as the only entry. Also note that the gateway for your BeagleBone must be your computer.

If you're not a newbie and need more detailed instructions, see this.

To continue from the answer provide by Vikas Arora, 3 things you have to do primarily to provide ethernet over usb connection to your Beaglebone. Firstly, share your PC internet connection with the local network made with Beaglebone, a process well explained above. And also setting up the IP address to be obtained automatically.

Secondly, setting up the nameserver to the public DNS server address 8.8.8.8 also explained above. But this setting is not persistent i.e. once you reboot, the settings will be lost. It is because the network manager on Angstrom 'connman' resets the etc/resolv.conf on startup. To correct that I disabled the connman service on my device by going to /lib/systemd/system and firing commands

systemctl stop connman.service

systemctl disable connman.service

This will make your nameserver file persistent and you can always start connman service again if you need.

Thirdly you have to set your gateway to the address of your internet sharing machine also explained above. But this setting is also not persistent. To do that make a script like below in your home directory

echo "********Setting up the default gateway"

route add default gw 192.168.7.1

and make a service that will kick off on startup and trigger your script. A process well explained at https://askubuntu.com/questions/506167/how-do-you-save-the-routing-table-on-the-beaglebone-blackangstrom

and

http://mattrichardson.com/BeagleBone-System-Services/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top