For the first time, I used in a real project IP Pool in Virtual Machine Manager 2012R2. Before that, I used as everyone a DHCP server or I set manually the IP addresses in network configuration. But this time I used IP Pools intensively to avoid these constraints. So in this topic I want to share you my happiness about IP Pool and how it is working.
But before it is important to understand what an IP Pool is. An IP Pool is like a DHCP server. There is an IP address range, and you can configure basic options as the gateway, the suffixes DNS and DNS itself or Wins server (who use that today ? J). An IP Pool is associated to a VM Subnet that belong to a VM network. For each VM Subnet it is possible to create one or more IP Pool while the IP addresses in the range belong to the VM subnet. For further information about the network components in Virtual Machine Manager you can view this topic. So IP Pool can only be used by Virtual Machines (VM) or virtual network card (vNIC) of hosts.
As you should know, on an IPv4 or an IPv6 network configuration you have two modes: dynamic or static configuration. When you use dynamic configuration, you must use a DHCP server that delivers network configuration (IP address, netmask, gateway and so on) instead of static configuration where you have to set manually (or by script). There are some disadvantages about using dynamic configuration. The first is that some applications don’t support dynamic IP (as Domain Controller, DHCP server itself and so on). So even if you use DHCP server, you have to set your IP configuration manually in some cases. The second disadvantage is that your IP can change (if you not manage reservation) and it is not good for a server. So most of the time on production network the IP configuration is set to static and managed manually.
And it is at this moment of the story that IP Pool is born. The difference with DHCP server is that when IP Pool delivers the IP configuration to a Guest OS, the network settings are static. This is why when you create a virtual machine in VMM you can specify if you want a dynamic IP or a static IP from IP Pool on network configuration as below.
There is no lease in the IP Pool instead of DHCP. When an IP is picked up in IP Pool, this last is allocated to a VM or a vNIC. So the network configuration on guest OS (or the vNIC) is the same until you change it manually. Unfortunately IP Pool can be selected at the VM creation only if you use a VM template. If you don’t use VM templates you have to set manually the IP configuration inside the Guest OS.
I will show you with some screenshot about how to create an IP Pool and the behavior of network configuration with IP Pool. To present that I will create an IP Pool with these settings:
- IP range: 192.168.1.150 – 192.168.1.160
- Netmask: 255.255.255.0
- Gateway: 192.168.1.254
- DNS: 192.168.1.100
- DNS Suffix: fabrikam.com
- WINS: No Way J
Two Virtual Machines will be created to show you the behavior of the Guest OS and the VMM network configuration:
- One VM called VMDYM01 will be created with dynamic option;
- One VM called VMIPP01 will be created from a VM template with IP Pool configuration.
Create and configure an IP Pool
First of all, I create an IP Pool called VM_Pool on my VM subnet 192.168.1.0/24 with above settings:
Now that my IP Pool is created, I can use it for my VMs.
From dynamic configuration to IP Pool (VMDYM01)
So my VMDYM01 has been created without VM template and so with dynamic IP configuration. As you can see below, the IP address of this VM doesn’t belong to my IP Pool.
Now I set manually the IP configuration inside the guest OS. I use an IP address belonging to the IP Pool:
After refreshing the VM in Virtual Machine Manager, I come back to connection details of the related virtual network interface:
Now it says that the IP address come from IP Pool “VM_Pool”. You can view which IP address from IP Pool is associated with VM (or vNIC) with the below PowerShell commands:
$IPPool = Get-SCStaticIPAddressPool –name "VM_Pool" Get-SCIPAddress –StaticIPAddressPool $IPPool
Now what happens if I change the network configuration on the Guest OS?
So I refresh the VM and I check the connection details in VMM:
Now I re-run the PowerShell commands to view the behavior in IP Pool:
$IPPool = Get-SCStaticIPAddressPool –name "VM_Pool" Get-SCIPAddress –StaticIPAddressPool $IPPool
So VMM has unallocated and released the unused IP address and has allocated the new one. Pretty impressive. I think to open a Facebook fan page about IP Pools.
About VM created from a template (VMIPP01)
For massive deployment, IP Pool can be used in VM template. In this way when the VM is created and ready, the IP configuration is already configured to static with IP Pool settings. So I have a VM template and as you can see below, I have set the virtual network card to static IP (from an IP Pool):
I deploy a VM from this template. When it is the Review the virtual machine settings screen you can specify an IP address belonging to the IP Pool or let it blank: in this case an IP available will be automatically allocated. I choose to let VMM manage this:
So when the VM is created, I go to verify the connection details:
Ok so IP Pool is used, this is a good start. Next I switch on the VM to verify the IP configuration on Guest OS:
The network configuration is set automatically at the VM creation. Pretty good no ?
I verify also the IP allocation in IP Pool:
$IPPool = Get-SCStaticIPAddressPool –name "VM_Pool" Get-SCIPAddress –StaticIPAddressPool $IPPool
So all it’s good J.
IP Address Management (IPAM)
As you have seen previously I use PowerShell commands to obtain information about IP address delivered by IP Pool. When you have thousands of IP addresses it can be difficult to find information except for PowerShell guys. With IP Address Management you can manage graphically the IP Pool component. This feature is available since Windows Server 2012 R2. So I have installed an IPAM server and I have configured the IPAM connector from Virtual Machine Manager. I obtain this information:
For guys who don’t like the PowerShell command line, it can be an alternative to manage network component of VMM.
Great job. You wrote very interesting articles.
Thanks for this comment
Hi I have one big problem, when i try to asign IP Pool to virtual machine (existing) this setting is not active, i can choose VM network, VLAN, switch and classification But IP address a MAC address is default Dynamic with no possibility to change it.
Thanks Roman
Hi Roman
If you have already deployed the virtual machine, the IP address fields are grey out. In this case you have to pick a non-used IP address in IP Pool and applied it manually in the Operating System. After a refresh of the virtual machine in VMM, the setting should be static.
The other solution is to use this script from Kristian Nese: https://kristiannese.blogspot.fr/2014/12/setting-static-ip-address-on-vm-post.html
Good evening.
Romain.
Thanks for your great articles. Very useful and easy to follow.I am a big fan .
In my case , when I deploy my Virtual machine with Static IP address Pool , my VM gets the DNS setting of the pool , but not the IP address that is automatically assigned by the Pool. Instead it gets an IP address form DHCP server.However, if I manually enter an IP address from the pool in my VM network adapter setting, VMM recognizes that and the IP address Pool excludes the address. This is all on a single subnet. Th VMM job for deploying the VM does not give any error or warning. I use a VM template that has a sysprep VHDX disk in order to deploy the image.
Any Suggestion would be greatly appreciated. 🙂
Hi,
Could you send me a screenshot of your VM template configuration (Network Adapter part) and a screenshot of the logical network view to my E-mail address ? You can find it in contact page.
Thank you 🙂
Romain.