Coder Social home page Coder Social logo

Comments (6)

ananace avatar ananace commented on July 28, 2024

Hello,

Hyper-V doesn't actually handle IP addresses, it only supports reading the value that the operating system has assigned to the virtual adapter. There's no way for the hypervisor to set this value, only the OS.
You can read and change the MAC address, as that's the hardware address, but the IP is handled on the operating system level and there's no method for Hyper-V to interfere there.

from fog-hyperv.

Surja1997 avatar Surja1997 commented on July 28, 2024

from fog-hyperv.

ananace avatar ananace commented on July 28, 2024

To connect to Hyper-V VMs before they have a running OS, you will RDP to the VM host and use the correct parameter for Hyper-V to pass the RDP connection on into the VM console.
https://superuser.com/questions/685968/directly-accessing-hyper-v-console-via-rdp - the answer contains information both for connecting with vmconnect and RDP on Windows, as well as FreeRDP otherwise.

If you - on the other hand - actually need to connect directly to the VM itself, then you will need to let it boot, have it install and run an operating system, let it get an IP address from your DHCP server, and then connect to that IP address.

from fog-hyperv.

Surja1997 avatar Surja1997 commented on July 28, 2024

from fog-hyperv.

ananace avatar ananace commented on July 28, 2024

What you will want to do for your use-case would be to set the VM's MAC address in your DHCP server to give it a fixed IP address.
Hyper-V is a regular hypervisor, one that only deals with the virtualization of hardware. The IP address that a running machine acquires isn't able to be decided by the network hardware, it's done on the OS level - either with a client that talks DHCP to get a lease on an address, or by statically configuring an IP address on the interface. Either way, Hyper-V is only able to affect the virtualized hardware itself, and the network adapter hardware itself doesn't have any say in this particular regard.

If other providers - cloud or not - allow for configuring the IP on a virtual machine inside of them, it's most likely done by them running a DHCP server internally which the VM will end up receiving the IP from. Or they're relying on the installation of VM tools, which would let the virtual machine communicate directly with the hypervisor to read a requested IP config and apply it on the OS level.

For my foreman_hyperv plugin, your scenario is done by; the user entering an IP in the Foreman interface when creating a host, a VM is then created in Hyper-V, launched for a second, before then being killed again so that Hyper-V has to generate a MAC address for it, then reconfigured to have that MAC address assigned statically to the adapter. After that, the DHCP server has an entry orchestrated to fix the chosen address to the generated MAC address, which the VM will then pick up when it next boots and runs a DHCP request.

from fog-hyperv.

Surja1997 avatar Surja1997 commented on July 28, 2024

from fog-hyperv.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.