Maas and network configuration

The problem is that although I already have an external dns/dhcp server, MAAS assigns a new ip to the machine during the commissioning and deployment process. After deployment, it finishes with “static” settings in the /netplan/50-cloud-init.yml network configuration file. At this stage, I would like to set “renderer: NetworkManager” and “dhcp4:true” parameters for the related interface, but I have not been successful.

1- Why MAAS is changing the ip address of the machines in a subnet that is not authoritative?

2- How can I set the network configuration I want at the end of the deployment? I wrote a cloud-init script as below but it does not apply it after deployment.

network:
version: 2
renderer: NetworkManager
ethernets:
eno1:
dhcp4: true

Thanks.

Hi @elperro,

As you might know the configuration with external DHCP servers is not officially supported by MAAS. Btw, have you tried changing the IP settings of the machine?

Yes when i changed the setting all is good ,but the real problem is that “MAAS” takes the IP already assigned to another machine in the subnet and assigns it to the machine it is going to commission.

have you reserved the ip range according to the doc?

Thanks, I solved this problem with reserved IP. How can I make the statically assigned network settings in the remaining 50-cloud-init.yaml file as dhcp4: true automatically during the deployment process so after deployment, the machine gets its IP from external dhcp.

Could you please rephrase the question? Isn’t the machine already obtaining its IP address from your DHCP server?

No, MAAS finishes the deployment with static IP settings in the /etc/netplan/50-cloud-init.yaml file.

To summarize:
I set IP range, MAAS can assign ip to machines after 192.168.1.240 for deployment.

1- For example client1: 192.168.1.29 is the address registered in DHCP.

2- MAAS assigns IP 192.168.1.242 when it starts PXE boot for deployment.

3- Deployment finishes and the 50-cloud-init.yml file contains the statically set IP address 192.168.1.242. I need to change this setting manually.

4- When I remove the static settings in the yaml file and enter
“dhcp4:true” and
“renderer: NetworkManager” parameters, it works as I want.

Thank you. I solved the problem with “cloud-init”.
Here is my solution:

runcmd:
  - 'echo "network:" > /etc/netplan/50-cloud-init.yaml'
  - 'echo "  version: 2" >> /etc/netplan/50-cloud-init.yaml'
  - 'echo "  renderer: NetworkManager" >> /etc/netplan/50-cloud-init.yaml'
  - 'echo "  ethernets:" >> /etc/netplan/50-cloud-init.yaml'
  - 'for iface in $(ls /sys/class/net/ | grep -E "eth|eno|enp"); do echo "    $iface:" >> /etc/netplan/50-cloud-init.yaml; echo "      dhcp4: true" >> /etc/netplan/50-cloud-init.yaml; done'
  - 'netplan apply'
1 Like