How do the Hyper-V machines get identical IPs even the physical machine has only 1 Network interface?
In windows 2008 we can have multiple Hyper-V instances on the same physical machine. Generally that machine has only 1 network interface. (I assume 1 card with 1 MAC Address). Then how do the Hyper-V machines get identical IP Addresses? Does the Network adapter need to support any special features?
Solution 1:
If your virtual machines are getting the same IP, it is probably an RFC1918 private address, which is being NAT'ed by the Hyper-V software hosting the guest OSs.
If your virtual machines have independent IPs on the same VLAN as the host, then Hyper-V is probably using a bridging virtual network adapter. This virtual adapter programs the network card to respond to several IP's at Layer 2 and forwards the correct packets to the guest OSs.
Solution 2:
In addition to the other answers, no you do not need a special NIC. VMs can get their own IP and even MAC address even though through one physical host NIC. This is similar (but not exactly like) to how you can assign multiple IP addresses to a single NIC even without using virtualization, directly in Windows. In that case however, you're not also hosting multiple MAC addresses.
Hyper-V, or VMware if you're running VMware Server or ESXi, or XenServer if you're using that, all take care of translating the networking so that multiple virtual machines can share the same physical NIC. Multiple physical NICs are still needed for redundancy and/or additional bandwitdh which may be a necessity if you have many virtual machines and/or high traffic (and if you're using centralized storage like a SAN, a dedicated NIC or NICs for that is highly recommended as well). But it will function with one.
Solution 3:
When you create a Virtual Network in Hyper V, you can choose:
- External: VMs attached to this network are considered to be attaching to the same network the Hyper V server connects to
- Internal: the Hyper V server creates an internal network, not connected to the physical network in any way, but the VMs connected to it can reach each other.
- Private: any VMs connected to this network are completely isolated, and can only see themselves
You have two settings to manage here. The network created in the Hyper V console, AND the network selected for each individual VM. If each VM is connected to a "Private" network, there's no reason they wouldn't/couldn't all have the same IP.
To answer your other question, for Internal & Private networks, the Hyper V server will assign internal IPs to those machines. For external, the VMs will get IPs (or not) just like any workstation you might connect to that network.
** Note: you should have a minimum of 2 physical network adapters in your Hyper V server, according to best practices. One for the server itself, and one for each External network you want to create for VM traffic. I've never tried only using one NIC, as there are said to be unpredictable results in this scenario.