Why does MAAS need to assign a new IP to the machine during the deployment process?
Example:
Host A: 192.168.35.20( external dhcp)
MAAS successfully commissions Host A with this IP(20). When I start the deployment process for Host A, MAAS assigns a random IP to this machine from DHCP and finishes the deployment process. If there is no free IP in the DHCP pool, “connection timeout” occurs at the cloud-init target stage. Is there a way to make MAAS use Host A’s already assigned IP(.20)?
By determining the DHCP range, I ensure that MAAS assigns an IP from the range I want temporarily, but why does it need to change the IP that is already assigned?
Sorry, I got it now: the machine gets an IP from your DHCP server and boots, then cloud-init asks MAAS for the network configuration and given that you selected “Auto IP” MAAS will look for a “free” IP in the subnet (outside the dynamic and reserved ranges) and craft the configuration.
Unfortunately it seems that you exausted the pool. Have you properly configured your external DHCP server to use only a specific range of IPs in the subnet and created the reserved range in MAAS?
Btw to answer your question: nope, MAAS can’t take the IP assigned by your DHCP server and statically assign it to the machine. This is in general wrong, you should reserve a range for static IP allocation by MAAS and a range for your addresses that your DHCP server will offer.
You might try to use the DHCP IP mode. That way the IP serving will be handled by your external DHCP server and depending on your configuration your machine might get the same address