MAAS to handle DHCP reservations For BMCs

Hello,

This feature request is off the back of this post.

Currently, MAAS is not able to effectively act as a DHCP server for BMC interfaces. Currently, we either have to configure BMC IPs manually (this stops scaling very quickly) or we have to maintain a separate DHCP server for the BMCs (not the end of the world but it would be great if we can handle this within MAAS entirely)

When a machine is added to MAAS, we have the option to configure a power type. Let’s take as an example the IPMI power type. In the UI, we have the ability to provide the username and password for the BMC and, of course., its IP (which MAAS will use to communicate with the BMC). In the same window, MAAS also allows us to fill in the BMC MAC, but as far as I can tell, MAAS does not do anything with that MAC.

If the BMC MAC is left empty during the creation of the machine, MAAS will populate the BMC MAC after it commissions the machine. Even then, though, MAAS doesn’t seem to do anything with the MAC other than record it.

Even if the BMC IP falls in a subnet that is part of a VLAN that has been configured for DHCP in MAAS, MAAS will not add a DHCP reservation for the BMC MAC into that VLAN. In fact, MAAS will act as a DHCP server for the VLAN (the machine’s BMC will receive an IP from the MAAS DHCP server) but the IP will be from within the VLANs “Reserved Dynamic Range”. This is not useful as the IP that the BMC receives from the DHCP server needs to be the same as the IP configured in the machine’s Power Type configuration section.

Reposting here the scenario from the original post, which was tried on MAAS 3.2.6 and MAAS 3.3.0. For more details on the scenario and answers to follow up questions, please see the original post. Happy to also answer questions here.

Our workflow is as follows:

  1. We have a fabric, let’s call it fabric0
  2. We have a tagged VLAN 20 within this fabric, call it “bmc-vlan”
  3. We have a single subnet within this vlan, call it “bmc-subnet”
  4. We have configured our MAAS rackd with a second interface and assigned it an IP on the “bmc-subnet”. Within the Ubuntu OS, this interface appears untagged. But the interface itself is connected to VLAN 20 on our switch.
  5. We enable DHCP on the “bmc-vlan” within MAAS and assigned it to the rackd from step 4
  6. We create a machine, call it “test-machine”, and configure the “power” option to the IPMI interface. We define the IP address, which is within the range of bmc-subnet, a BMC MAC.
  7. When we look at the “bmc-subnet” in MAAS, we see that the IP address of the BMC of test-machine shows up under “used IP address” of the subnet with a type of “Sticky”.

When the BMC is connected to the network, it receives an IP from the MAAS “Reserved Dynamic Range” range of bmc-subnet and not the IP that was defined under the “power” options of test-machine.

When I look at /var/snap/maas/common/maas/dhcpd.conf on the rackd server from step 4, I do see the bmc-subnet defined. I do not see, however, a “host” (DHCP reservation) defined for the MAC address of the BMC of test-machine. I do see “host” entries for the non-BMC interfaces of other hosts.

If I true to use the “devices” option in MAAS to create a “device” for the BMC of test-machine, I get an error that the IP already exists.

Thanks for your consideration of this feature request!

2 Likes

An addition like this would be amazing.

I am trying to accomplish something similar. Currently I have machines on a subnet managed by an external DHCP server, and then I have another subnet for the BMCs.

Right now I have MAAS handling DHCP for the BMCs, and then when I connect a new BMC, I need to use the MAC to find the IP it assigned. I’m not sure if there’s an easier way, but I’m using nmap and grep to manually get the assigned IP, and then I add that IP to a DHCP snippet paired with the MAC address.

Hey @wespiard, thanks for the reply.

Regarding:

Right now I have MAAS handling DHCP for the BMCs, and then when I connect a new BMC, I need to use the MAC to find the IP it assigned

Do you use the BMC IP as a power source for servers in MAAS, then? If so, how did you configure the DHCP options in the BMC VLAN? Did you only have a dynamic range?

Also, did MAAS let you assign the IPs of the BMC that were assigned via DHCP in the power configuration? In my workflow (where I was trying to do DHCP configurations by creating “devices” for the BMCs), MAAS was not letting me use the IPs I had reserved via “devices” as the IP of the power config of a server.

Thanks,
t

Hey @tfable,

I actually figured out a little more today. I was using a dynamic range, but this wasn’t really effective use with DHCP snippets. Basically, we want MAAS’ DHCP server to be handling DHCP reservations, and not doing dynamic DHCP assignments (for the BMCs, at least). Not saying this is always the case, but it’s working for me.

I’ll try to be verbose with an example in case it helps anyone. In my case all of the BMCs are connected to a switch, and the switch is connected to my machine that is running MAAS (on a second ethernet port).

So now, I have a reserved range (not dynamic). For example, let’s say the range is 192.168.10.10-192.168.10.49.

Then, if I want to add a machine, I need to know its BMC’s MAC address, and an IP in this range I’d like reserved. So for example, if I have a new machine, machine-01, I’d first get its BMC’s MAC (using the server’s BIOS, checking for labels on the chassis, etc.) and then choose an IP in this range. If I want to use the first address in the range, I’d add a DHCP snippet in the MAAS Settings like this:

host machine-01 {
    hardware ethernet XX:XX:XX:XX:XX:XX;
    fixed-address 192.168.10.10;
}

Once you save and enable the snippet, a host entry is inserted in the /var/snap/maas/common/maas/dhcpd.conf file and this IP should be assigned to your new machine once its BMC is connected to the network.

Before adding a new machine in MAAS, double check your new machine’s BMC actually got the correct IP by using the BIOS, ping, or ipmitool on the MAAS server. If you can access the BMC, chances are MAAS will be able to.

Finally, add a new machine in MAAS. Select the “power type” that applies to your server’s BMC. Enter the IP from the DHCP snippet into the required address field, and then the username and password for the BMC’s interface.

1 Like

Thanks, @wespiard! This is a neat trick. We are trying to avoid snippets for now as they are hard to capture in our Infrastructure as Code (Terraform) setup but we will give this a shot in the lab at some point.

Thanks again!

1 Like