As part of my VM creation, private IP is always constantly getting assigned and then getting error:
add_ips: You have entered an IP that is in another Unix / Network SSH / Checkpoint Firewall / Cisco record. Each IP may only be included in one record of the same type.
As the same IP is getting assigned there is conflict happening. How to get different IP assigned to NICS for different VMs?
What level of infrastructure change is required?
VINITA TAHILIANI is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1
To resolve the issue of conflicting private IP assignments, follow the steps below
first create a virtual network and a subnet
az network vnet create --resource-group arkorg --name arkoVnet --address-prefix 10.0.0.0/16 --subnet-name arkoSubnet --subnet-prefix 10.0.1.0/24
To secure the subnet, you can associate it with a NSG
az network nsg create --resource-group arkorg --name arkoNSG
az network vnet subnet update --vnet-name arkoVnet --name arkoSubnet --resource-group arkorg --network-security-group arkoNSG
Now create two VMs, and the NICs for both these VMs will be assigned with two different private IPs dynamically from the subnet.
az vm create --resource-group arkorg --name arkoVM1 --image UbuntuLTS --vnet-name arkoVnet --subnet arkoSubnet --admin-username arko --admin-password Hellomoto --nsg arkoNSG
az vm create --resource-group arkorg --name arkoVM2 --image UbuntuLTS --vnet-name arkoVnet --subnet arkoSubnet --admin-username arko --admin-password Hellomoto --nsg arkoNSG
Here we’re ensuring the NICs for both arkoVM1 and arkoVM2 are assigned dynamic private IP addresses from the arkoSubnet. The private IPs will be automatically assigned by Azure from the available IP range in the subnet.
Once the VMs are created, you can verify the private IP addresses assigned to the NICs to ensure there is no conflict.
az vm list-ip-addresses --name arkoVM1 --resource-group arkorg --output table
az vm list-ip-addresses --name arkoVM2 --resource-group arkorg --output table
As you can see from the output, both arkoVM1 and arkoVM2 have been assigned different private IP addresses (10.0.1.4 and 10.0.1.5) which means the conflict issue is resolved.