Page 1 of 1

Integration of a VirtualBox VM into a LAN

Posted: 24. Nov 2010, 11:29
by ordipb
Hello,

I use VirtualBox 3.2.10 on a Host running Wndows 7 Pro 64 bits. I defined a virtual machine (VM) Ubuntu 10.10.
I would link this VM into the LAN.

The easiest solution (which was proposed by chopinhauer, in the french forum //forum.ubuntu-fr.org, whom I thank again) is to establish a network bridge in VirtualBox and in Windows 7.

1. In the settings of the VirtualBox VM (the VM being shut down), go to Network setting.
Adapter 1 (where "Activate the network adapter" is marked) [Sorry if my translation from French settings to English is not perfectly exact ; I use a french version].
In the field "Network access mode", NAT is prompted. You need to change it to "Bridge access". After, in my case, "MAC Bridge Miniport" appeared automatically in the field Name. It's not the usual situation. You would have automatically the name of your adapter, the Guest's physical adpater (in my case a Realtek one). If you have the name of your physical adapter, that's good : you have not to do the second step. In my case, I had not my physical adapter, probably because of a bad installation. If you have not (if you have MAC Bridge Miniport, don't worry : the second step will salve you.
Come back to the general settings page. You see now, for Network Adapter 1, "Intel PRO/1000 MT Desktop (bridge with the MAC Bridge Miniport interface)", or, better, instead of MAC Bridge Miniport, the name of your physical interface.

2. Do this step only if your physical adapter was not prompted in the first step and you have MAC Bridget Miniport instead. On the Host, in Windows 7 :
Go to Network and Share Center (by Configuration Pannel), and do "Modify parameters of the network adapter". Define a network bridge between the 2 adapters : the Host's physical adapter and the adapter "VirtualBox Host-Only Network". To do this, select both adapters (click on one, and Ctrl-Click on the other). Do a right-click on this selection and click on "Bridge connections".
An icon "Network bridge" is added. Few seconds later, the authentication will be done and the bridge will be usable.

In VirtualBox, when you start now the VM, le DHCP server of the LAN sets automatically to the VM an IP address of the LAN.
So, the VM (in my case, an Ubuntu) is now a station of the LAN and it can communicate with all other stations of the LAN.

There is another solution, a classic one, but I could not set it up : a route between 2 LANs. I explain it.

The default for the VM's adapter 1, in VirtualBox, is NAT (see above). In this case, VirtualBox sets to the VM an IP similar to 10.0.2.15 and it sets also to the Host a second IP as 10.0.2.2. So, the VM and the Host are members of a new network 10.0.2.0, added to the previous LAN 192.168.0.0 for instance and the Host is like a router (router being a machine on to LAN).
Thus we have 2 LANs which we have to connect by a route.

From the VM to the 192.168.0.0 LAN stations, the route is automatically established : you can ping all the stations of the 192.168.0.0 LAN. But, from the LAN stations to the VM, the ping does not pass. It is necessary to establish the routing on each stations (at least, it is so in Linux stations ; I did'nt try on Windows stations).
On Linux stations (Ubuntu 10.10), you have to do (being root ; in console mode, sudo su) the command :
route add -net 10.0.2.0/24 gw 192.168.0.2 (this last one being the Host's IP).
This would run (prompting the route table by route, you see that the routes are good).
But, in my case, this worked one time only ; in all others attempts, I allways had the answer to the ping :
From 192.168.0.2 : icmp_seq=1 Redirect Network (New nexthop: 192.168.0.1) this last one beeing the IP of the Netgear router which set the access to Internet and DHCP service for the LAN ; this IP is defined, in the route table, as the default.

I cound'nt solve this problem and I left it, because the network bridge solution is very easier.

Re: Integration of a VirtualBox VM into a LAN

Posted: 24. Nov 2010, 20:49
by Sasquatch
There is no need to manually bridged adapters on the Host. Undo whatever you did and just select the proper physical adapter in the VM settings. If the adapter cannot be chosen, then you have to verify the existence of the VirtualBox Bridged filter in the properties of the interface and if it's enabled. If it's missing, you can try and add it manually, or repair the installation. It's also possible that you disabled the Networking support in the installer, but you shouldn't see the mac minibridge either.

n this

Posted: 24. Nov 2010, 21:17
by ordipb
I am sorry, Sasquatch, in my case, if I remove the network bridge in Windows 7, the VM can't start. When I establish the windows' bridge again, the VM runs perfectly.

It's the reason why I say that the network bridge in Windows is necesarry.

And this is in spite of the fact that I have the proper physical adapter in the VM setting.

Re: Integration of a VirtualBox VM into a LAN

Posted: 24. Nov 2010, 21:24
by Sasquatch
You selected the wrong one. The MAC miniport is just some virtual adapter that doesn't point to anything. It's a Windows thing. You need to select your real adapter.

Re: Integration of a VirtualBox VM into a LAN

Posted: 24. Nov 2010, 21:53
by ordipb
OK, Sasquatch, I agree that I choosed the bad adapter.

But, in the field Name (with Bridge Access), I have only "MAC BRIDGE Miniport", nothing else. And I don't know how to add another. With Advanced, I choosed Intet PRO/1000 MT Desktop (8254OEM) ; I have others, but not the physical adpater of the Host which is a Realtek PCIe GBE familly controller. I don't know how to add it in the list.

However, this case is interesting : with a bad choosen adapter, it's possible to have an operational bridge, with the complement of a Network bridge in windows.

Thank you for your indications.

Re: Integration of a VirtualBox VM into a LAN

Posted: 24. Nov 2010, 22:41
by Sasquatch
The one you have is not going to work. As I stated before, it's a virtual adapter, you won't see it in your Network Center. I posted instructions to get the adapter above. Did you read anything at all?

Re: Integration of a VirtualBox VM into a LAN

Posted: 24. Nov 2010, 23:45
by ordipb
Sasquatch, you wrote : "I posted instructions to get the adapter above". Are these instructions :
"If it's missing" [that is : if the physical adapter is missing]", you can try and add it manually" ?

I don't know how to add manually an adapter. Can you explain this ? Thank you in advance.

Re: Integration of a VirtualBox VM into a LAN

Posted: 24. Nov 2010, 23:58
by Sasquatch
Or REPAIR VIRTUALBOX. If that fails, remove VB, reboot, and install again. Make sure every option is enabled.

Re: Integration of a VirtualBox VM into a LAN

Posted: 25. Nov 2010, 08:43
by ordipb
OK, Sasquatch, I understand that the necessity of the network bridge in Windows 7 is due to a bad installation and, because of this, I can choose, in the field Name the Host's physical adapter.

I did a Repair reinstallation. No change.
I don't agree to remove VB and fully reinstall. My installation runs perfectly as it is. As we say for sport, we don't change a winning team ! I am sorry.

But I modify my first post above, according with your informations.

Thank you again. Have a good day.

Re: Integration of a VirtualBox VM into a LAN

Posted: 25. Nov 2010, 20:18
by ordipb
Hello Sasquatch,

Without doing nothing else a remove of the Network Bridge in Wndows 7 and a reboot of the Host (not the reboot after installation repair, which did not change nothing), the name of the Guest's physical adapter was prompted in the field Name of Netword in settings of the VM in VB.
It's a miracle !

Well, with this, my configuration is now normal.

According to this, a modified a second time my initial post.

Have a good evening (or a good day ; I don't know what time is it where you are).