Connecting VM to host via ethernet (bridged mode, maybe)

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
brianjb
Posts: 7
Joined: 17. Apr 2013, 03:33

Connecting VM to host via ethernet (bridged mode, maybe)

Post by brianjb »

I am not that great with networking.

Here is m current setup:

Mac OSX 10.7.5
Ethernet (this isn't plugged in by the way...I am strictly wifi):
IP 10.0.2.23
Mask 255.255.255.0
GW blank

Virtual host (red hat)
IP 10.0.2.22
Mask 255.255.255.0
GW blank

In the settings for the virtual machine, I have this for the adaptor (note that at one time I had an internal network and a NAT one enabled as well...those are disable right now) :
Attached to: Bridge Adaptor
Name (I have tried both p2p0 and also en0 Ethernet)
In the advanced section, I chose 'allow all' under promiscuous mode


For a little background on why I am trying to do what I am doing. There is a certain application on the virtual machine that I need to access. One way I have found around this is to fire up another virtual (an windows 7 machine) and then I can connect to it. I connect to it, because both of those virtuals had an internal network adaptor defined. The problem with this is that I had to keep both virtuals running and it slows my hosts computer. So if I can connect to the virtual with my host computer, it would save a lot of headache.

The application that I am trying to access is via a web browser, so I need to be able to type https://10.0.2.22 in the browser on my host and get to the virtual machine.

Any feedback appreciated!!!
brianjb
Posts: 7
Joined: 17. Apr 2013, 03:33

Re: Connecting VM to host via ethernet (bridged mode, maybe)

Post by brianjb »

I guess, maybe talk me through this like I'm a 3 year old. What IP info should I assign to my ethernet on the laptop. And what should I do to the virtual IP-wise? Then let me know what kind of adaptor to use. I am doing bridged based on my google searches, but if that's far off let me know.
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Connecting VM to host via ethernet (bridged mode, maybe)

Post by noteirak »

To make it very easy : go Host-Only mode.

In order :
1. Create a host-only interface on the host, if none exist so far
2. In the VM settings, set to Host-Only mode
3. Select the Host-Only interface in the dropdown list just under
4. Start your VM, set the interface in the guest in DHCP mode
5. You should obtain an adress in the 192.168.56.x range
6. use that IP for whatever you want to do
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
brianjb
Posts: 7
Joined: 17. Apr 2013, 03:33

Re: Connecting VM to host via ethernet (bridged mode, maybe)

Post by brianjb »

That sounds great. The only issue I see is that on my host, I can't do DHCP.

It is an appliance based on Linux. I have to hard set the IP address, netmask, gateway. What should I do in this example?

Thanks!
noteirak
Site Moderator
Posts: 5231
Joined: 13. Jan 2012, 11:14
Primary OS: Debian other
VBox Version: OSE Debian
Guest OSses: Debian, Win 2k8, Win 7
Contact:

Re: Connecting VM to host via ethernet (bridged mode, maybe)

Post by noteirak »

You don't need DHCP, it is built-in Virtualbox and is enabled by default on Host-Only bridging, so the guest gets an IP via the Virtualbox integrated DHCP - just like in NAT mode.
Hyperbox - Virtual Infrastructure Manager - https://apps.kamax.lu/hyperbox/
Manage your VirtualBox infrastructure the free way!
brianjb
Posts: 7
Joined: 17. Apr 2013, 03:33

Re: Connecting VM to host via ethernet (bridged mode, maybe)

Post by brianjb »

noteirak wrote:You don't need DHCP, it is built-in Virtualbox and is enabled by default on Host-Only bridging, so the guest gets an IP via the Virtualbox integrated DHCP - just like in NAT mode.
Thank you for the advice! I was able to get this to work.

Like I said, my appliance that I install doesn't use DHCP. SO what I did was to create the host only network. I went to virtualbox, preferences, network tab, then added one. I saw what IP and netmask that my host only adaptor had. Then I hard set the appliance to be on the same network. Now I am able to access my virtual with Safari on my host.

Thanks so much!

I am definitely saving these steps in evernote, for future use.

You can mark this as resolved.
Post Reply