Page 1 of 1

How to share internet?

Posted: 3. Sep 2013, 16:07
by emptycoder
Hello everyone, this is my first post on VirtualBox forum and I desperately need help!
I have posted my problem almost on every forum and yet couldn't find someone to help me.
I'm using Ubuntu 12.04 with Windows 7 Installed as a Virtual Machine, the only way for me to access the Internet is using a WiMax USB Modem which is not available for Linux, I managed to install it on Windows and get it to work but I don't know how to share that connection with Ubuntu.
Could someone shows me an easy way to do that or provide me a step by step guide, I'm no expert so I don't know much about networking, Thanks!

Re: How to share internet?

Posted: 3. Sep 2013, 17:36
by emptycoder
Anyone?

Re: How to share internet?

Posted: 3. Sep 2013, 18:42
by noteirak
The way you want to achieve this is by adding a host-only interface in Virtualbox in the host, and configuring the same Host-Only interface for the Windows Guest.
After that, you can use the share connection feature of Windows in the property of the connection, and by configuring the host-only interface in the host with a gateway, being set to the IP of the guest on the host-only interface.
The only place where Virtualbox is involved is by using the host-only networking mode to create a connection between your host and your guest, like they were two real computers sitting next to each others.
Anything else is normally outside of the scope of this forum and all the details can be found on internet. I will give you the details here but if you require more support, please look first on Google.

So in more technical details :
In the host :
In the Virtualbox Manager, go into the File menu, Preferences...
Go into the network tab, and click on the little card icon with a green +, this will add a host-only interface.
Click on the new interface, then on the screwdriver on the right. Set the IP address to 192.168.56.1 with a netmask of 255.255.255.0 if not set already. Go into the DHCP Tab and disable it.
Then, using normal regular network interface configuration, set a gateway to 192.168.56.2

Configure the guest to only use a Host-Only interface, bound on the interface you just created above.

In the guest :
Go into the network connections, and right click on the network interface, sharing tab, and check the "allow other users to use this connection"
Confgure the interface to use the 192.168.56.2 ip with a netmask of 255.255.255.0

Connect to internet and it should now work.

Re: How to share internet?

Posted: 4. Sep 2013, 14:17
by emptycoder
Thanks a lot for your reply, I followed your guide and I faced two problems.
The first one is the Getway, I couldn't find it so I can set it to 192.168.56.2
The second problem was network sharing on Windows, when I change IPv4 settings to 192.168.56.2 with a netmask of 255.255.255.0 it disconnects, and it won't reconnect to USB modem until I remove those settings and set it back to Obtain an ip Address Automatically, I'm just not sure if this a Windows problem or VirtualBox problem.
I tried to look for solutions on Google but with no luck.

Re: How to share internet?

Posted: 4. Sep 2013, 19:41
by noteirak
See my attached screenshot for the gateway location.

For the second problem, I expect you to have two interfaces, one for your modem, one for Virtualbox. Set the IP on the Virtualbox interface. If you are not sure which one it is, check the MAC address in the status tab from the guest, it should start by 080027

Re: How to share internet?

Posted: 4. Sep 2013, 21:12
by emptycoder
Thanks for attached screenshot, but there's something really strange, the Getway always empty, I entered IP 192.168.56.2 and saved it but when I open it again there's nothing, why is that?
And yes, I have two Networks, one is WiMax Adapter and the second one (VirtualBox I guess) is named Intel(R) PRO/1000 MT Desktop Adapter, but what IP should I use on second network? I tried 192.168.56.2 but an error messages says I can't use same IP.

Re: How to share internet?

Posted: 4. Sep 2013, 21:22
by noteirak
Oh my bad, you have a Linux host, so don't follow that screeshot. I don't have a linux distro with a GUI at hand so I can't help you here...
Don't change the config of the WiMax adapter, that is configured by your USB router. Only configured the Intel one. If you've set something on the WiMax, put it back on how it was (most likely get IP automatically)

Re: How to share internet?

Posted: 5. Sep 2013, 17:09
by emptycoder
So what should I do now? I really need this problem to be fixed, should I repost this thread again so I can get help from someone else?

Re: How to share internet?

Posted: 5. Sep 2013, 17:44
by noteirak
Well the gateway business is a very standart network feature, so any how-to on google will get you there. This is already way out of scope of this forum, so I would seek more support on a network forum for the details of that part.
Nothing is different from a network point of view because you use Virtualbox : it still behaves like if you had two computer sitting next to each other, so the steps are the same.

Re: How to share internet?

Posted: 5. Sep 2013, 17:54
by emptycoder
The problem is that I'm not an expert, it might sounds easy to you but it's not to me, I don't know where to edit that getway on Ubuntu, and I don't even know how Ubuntu would detect network sharing from VirtualBox, like do I have to create new network to connect or the host will detect it by it's own.
I was looking for a step-by-step guide to solve my problem, I even tried to share the connection via Wifi, from guest to host but the option of enable it wasn't there on the Guest, just wired networks.
Sorry to be troublesome, but I can't find a way to make it work.

Re: How to share internet?

Posted: 5. Sep 2013, 18:01
by noteirak
I already gave you the steps on what to do, including Virtualbox parts. Anything more detailed is not in scope of this forum (as it can for some lenght) but is extensively covered on internet, and Google yell a lot of results.

Re: How to share internet?

Posted: 23. May 2016, 14:20
by JoeK112
Retracing your steps for the Host:
1. In the Virtualbox Manager, go into the File menu, Preferences... (select the "Host Only Interface" Tab to get to this)
2. Go into the network tab, and click on the little card icon with a green +, this will add a host-only interface. (check)
3. Click on the new interface, then on the screwdriver on the right. Set the IP address to 192.168.56.1 with a netmask of 255.255.255.0 if not set already. (check)
4. Go into the DHCP Tab and disable it. (check)

5. Then, using normal regular network interface configuration, set a gateway to 192.168.56.2
- Total Failure on this step - I could not get a "gateway" to work in the Linux host. Following instructions that look like something out of the 1970s, I typed in some cryptic commands, then checked the status with more commands and flags, and it appears it is not 'sticking'.

Then...
"Configure the guest to only use a Host-Only interface, bound on the interface you just created above."
- I did not know what was meant by this at first. Perhaps in the VirtualBox Guest's window, you must select Devices, Network, Network-Settings, then "attached to" select "Host Only Adapter". Otherwise, your Guest will never know of any Host Only connection you created in the Virtualbox Manager window.

Then we get to the Guest settings:
1. Go into the network connections, and right click on the network interface, sharing tab, and check the "allow other users to use this connection."
- This is not an option for the "Local Area Connection", which I think is set in the next step? You can share other things, like modems that are attached, on their "Advanced" tab, in WindowsXP (right-click on it, Properties -> Advanced-tab). Maybe that is what get's shared, and the "windows sharing" makes it available to connections through its LAN connection in the next step?

2. Configure the interface to use the 192.168.56.2 ip with a netmask of 255.255.255.0.
- I assume this is the "Local Area Connection" > Properties > Internet Protocol (TCP/IP), and then "Use the following IP Address" radio-button, and put those in the fields. And this will be the "gateway" for the Host?

Those of us who use OSes as mere foundations for our tools need complete "hand-holding baby steps" for exactly what to do / click-on / configure in the VirtualBox Manager, the Host, and the Guest. Saying these are not "in scope" of VirtualBox - well, I searched Google and it brought me here. We are Using VirtualBox to do this, so the entire picture needs to be tied together in one place - why not here?

I have added what I could to attempt to clarify the parts of the process I understand, but please correct any errors. A "how to" that includes all the missing pieces to these instructions would be greatly appreciated, so hopefully someone more knowledgeable than myself can finish the job.

This is critical info, because LinuxOS developers work primary on "server" features, and there is next to zero priority for supporting anything beyond a plain-vanilla ethernet Internet connection and a few WiFi IFs (if you are lucky). As a result, most modern Internet-devices only have a Windows driver. VirtualBox is the only solution I know of to allow these devices to be used with a LinuxOS machine.