10

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.

BDL
  • 18,169
  • 14
  • 45
  • 47
Vikas Arora
  • 1,648
  • 2
  • 16
  • 35

5 Answers5

23

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.

Vikas Arora
  • 1,648
  • 2
  • 16
  • 35
  • Two points: 1) As a heads up to others who want to do this, I had to do some considerable fiddling with network connections to get Windows to share my internet connection with the BeagleBone, including rebooting and turning off/on my other local area connection. But in the end, the fiddling payed off. (2) The instructions at the [link provided above](http://derekmolloy.ie/beaglebone/getting-started-usb-network-adapter-on-the-beaglebone/) may make this process clearer (I found it helpful). – Sesquipedal Jan 17 '15 at 06:26
  • 1
    Hello. This is really helpful for me, but I have some question: 1) how to share connection under Linux instead of Windows? 2) Enabling VNC, after entering the line you provided, BB wont reply with port 5900, and I'm unable to connect to VNC, it says connection refused by host computer. Can you help me please? – Nur Apr 07 '15 at 07:05
  • 1
    @Nur, you should open a new question. – Kyle Strand Apr 30 '15 at 00:33
4

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

Muneeb
  • 41
  • 3
0

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

0

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.

a-Jays
  • 1,182
  • 8
  • 19
  • Is the ConnMan utility only available in Angstrom distribution of the BeagleBone Black? I don't have it on my BeagleBone Black, which is running Debian GNU/Linux 7. – Thomas Hsieh Apr 09 '15 at 18:59
  • 1
    Yes, Connman is in Angstrom. Other distros have their own network managers. I think Debian has `network/interfaces` – a-Jays Apr 10 '15 at 04:22
  • Thanks a lot! I have been bothered by the ConnMan utility for a few weeks, especially since beaglebone.org claims that all BeagleBone Black run the Debian distro, I just assumed that all online tutorials would be for the Debian distro... – Thomas Hsieh Apr 10 '15 at 04:51
  • I'm not a great fan of Angstrom. I found Ubuntu for BeagleBone a far better choice (for my purpose at least). – a-Jays Apr 10 '15 at 06:29
0

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/

Community
  • 1
  • 1
Sidhant101
  • 39
  • 1
  • 4