How to set the IP of my VM

Discussions related to using VirtualBox on Mac OS X hosts.
Post Reply
rabol
Posts: 11
Joined: 10. Nov 2011, 23:12
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows

How to set the IP of my VM

Post by rabol »

Hi

Please forgive me if this is a FAQ, but I normally use Windows/Hyper-V, but I have a Mac Mini and I just want to run a Windows 2012R2 Domain controller using VirtualBox.

So I Hyper-V, It is very simple to add a Network card, and specify the IP for the machine, but in Virtualbox, it does not seems to be very easy.

Did I miss something?

Any hints is highly appriciated.

Thanks in advance.

Kind regards
Steen
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to set the IP of my VM

Post by mpack »

It is not common to manually set IPs for PCs on a network - I think you've probably misunderstood the Hyper-v feature.

IPs are handed out by DHCP servers. If for some reason you really do need to manually configure a guest to use a static IP then you would do that inside the guest, and it would really be none of VirtualBox's business (or Hyper-v's).

What you are probably referring to is configuring a DHCP server, to control what range of IP addresses it will output. You would normally just use the defaults, or at least just configure it once. If you expect to need to do it every time you add a PC to the network then you must be doing it wrong!

So, it seems to me that you should be using bridged network to connect the VM to a physical network - and you should leave IP assignment to whatever DHCP server is already working on that network.
rabol
Posts: 11
Joined: 10. Nov 2011, 23:12
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows

Re: How to set the IP of my VM

Post by rabol »

Hi

I understand your point about the DHCP, but I would like to have a static IP for the VM - I know that I can reserve the 'specific' IP, but... :)

I do not think I misunderstood the hyper-v feature, and I agree that my question could be misunderstood.

So here is some clarification:

In hyper-V, i just add a network card that is (probably) bridged to my real network card, and then in my guest i set the IP

So if i understand you correctly I should use 'Bridged adapter' and then it should work?

Kind regards
Steen
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to set the IP of my VM

Post by mpack »

Suppose you tell me what your goal is, rather than telling me what you think the solution would be on Hyper-v?

For example, if your goal is to give Internet access to the VM, then NAT will suffice - and let the NAT DHCP server worry about assigning a dummy IP to the VM.

If your VM needs a complete presence on a physical network (i.e. the ability to receive connections as well as make them), then you would use bridged mode. However in that case you still wouldn't normally need to manually configure an IP address - that would be left for an attached router to do.

And finally, as I said before, if you do need to configure a static IP address then that is matter between you and the software you're configuring. It isn't a matter for the hardware - even simulated hardware.
rabol
Posts: 11
Joined: 10. Nov 2011, 23:12
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows

Re: How to set the IP of my VM

Post by rabol »

okay...

What I would like is:

RDP into the VM from another computer.

So my setup is like this:
Mac Mini running Virtual Box, (IP from DHCP 192.168.0.xx), then I would like the VM (Windows Server 2012R2) to get an IP 192.168.0.xx so I can RDP into that VM from a computer on the same physical network, and the I will setup port forwarding in my router to the VM (Hence, why I need/want a static IP on the VM) so I can reach the VM when I'm traveling.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How to set the IP of my VM

Post by BillG »

Very little of that has anything to do with VirtualBox. The only thing that concerns VirtualBox is having the vm in the same network as the physical machines on the physical network, and to do that you use the bridged option for the NIC in the vm.

After that it is purely a networking issue, and works exactly as if the vm was another physical machine on the physical network. The vm would normally get its IP from DHCP on the physical network. If you want it to have a specific IP, use reservations in DHCP or assign it statically (just as you would for any other machine on the LAN, or in a Hyper-V guest connected to an external virtual network).
Bill
rabol
Posts: 11
Joined: 10. Nov 2011, 23:12
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows

Re: How to set the IP of my VM

Post by rabol »

well... This is also what I expected, but in my case it does not work, which is why I ask for hints on what I could have done wrong.

So far you have just been constanly pointing out how bad it is that I do not use DHCP and telling me that is should work.

Thank you so much for your time

I'll find another solution!
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: How to set the IP of my VM

Post by mpack »

That's a strange way to put it. We're not saying "it's bad that you don't use DHCP", we're saying that DHCP is the only solution we know of, given the scenario posed. If that isn't good enough then you need to a better job of explaining why your scenario requires another solution.

So far, the form of answer you seem to be insistant on getting is in fact impossible to give: hardware cannot dictate the IP address used by software running on a PC. At best it's possible to offer suggestions via a suitable network address space management protocol, in other words - DHCP.

A final thought, you do understand the difference between an IP address and a MAC address, right? And it's definitely the former you wanted to configure and not the latter?
rabol
Posts: 11
Joined: 10. Nov 2011, 23:12
Primary OS: Mac OS X other
VBox Version: OSE other
Guest OSses: Windows

Re: How to set the IP of my VM

Post by rabol »

Hi

Yes, i know the difference between a MAC address and an IP address - Normally servers have STATIC IP addresses as it will be a mess if they change IP

As I said, I will find another solution, in fact I have a IMac running Windows 8 so I just installed Hyper-V and created an new VM, installed Windows Server and specified the IP in the NIC in the VM and it's working perfectly.

What I wanted was to reuse a Mac Mini and do exactly the same just using VirtualBox instead of Hyper-V, but that is apparently not possible.

So problem is solved now.

Thanks for your time.
BillG
Volunteer
Posts: 5106
Joined: 19. Sep 2009, 04:44
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows 10,7 and earlier
Location: Sydney, Australia

Re: How to set the IP of my VM

Post by BillG »

I have been using Hyper-V since its inception (since the beta in fact) and I have been using VirtualBox almost as long. I have been building parallel solutions on the two systems for most of that time. I have never seen the behaviour you report. I can only assume it is some odd mismatch between the VirtualBox filter driver and the NIC driver in the Mac Mini host.
Bill
Post Reply