Q&A: Does the computer import uses recycled ipaddresses?

Question:

If I have already a lot of clients in my network and 30 clients need to be replaced, will the freed IP addresses after deleting the clients be reused?
Does the import will use these freed IP addresses or will it use the IP addresses till the end of the defined subnet and fail, if no IP address is available anymore?

Answer:

In ucs-school-lib/modules/ucsschool/lib/models/computer.py
we see

if self._ip_is_set_to_subnet(ipv4_network):
    self.logger.info(
        "IP was set to subnet. Unsetting it on the computer so that UDM can do some magic: "
        "Assign next free IP!"
    )
    udm_obj["ip"] = []
else:

So this seems to be a UDM feature.

If a network is set but the IP address not, UDM starts with the first usable IP address of the network.

management/univention-directory-manager-modules/modules/univention/admin/handlers/networks/network.py

self['nextIp'] = str(network.network_address + 1)  # first usable host address in network

and in a loop

  • looks for an aRecord with that value
  • if the aRecord exist, the next IP address (stepIP) is calculated and we start another search
  • if no aRecord exist we have our IP address

So the IP addresses will be ‘recycled’.

Creating a computer object with network but no IP address in UMC, computer got 10.200.7.2 as address. When the computer is removed and another one created, the new computer object got also 10.200.7.2 as IP address.

2 Likes
Mastodon