# Vnet mac pool reuse too quickly

**URL:** <https://forum.opennebula.io/t/vnet-mac-pool-reuse-too-quickly/13621>\
**Category:** Installation & Configuration\
**Created:** [February 28, 2025, 7:29pm UTC](https://forum.opennebula.io/t/vnet-mac-pool-reuse-too-quickly/13621 "2025-02-28T19:29:54Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![kemcfarl](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kemcfarl](https://forum.opennebula.io/u/kemcfarl)\
**Post date:** [February 28, 2025, 7:29pm UTC](https://forum.opennebula.io/t/vnet-mac-pool-reuse-too-quickly/13621/1 "2025-02-28T19:29:54Z")

</div>

Hi,

We have an automated VM environment where VMs are created & deleted frequently each day. Most of these VM are using IPv4 DHCP. The mac-address reuse makes it challenging for our automation to find the mac/IP mapping at the external dhcp server. The previous IP hasn’t timed out yet for the deleted VM. (we have a 15 min lifetime).

The virtual network MAC pool on OpenNebula v6.10 re-uses the just released MAC for the very next VM’s vNIC. While this is all technically correct from a networking perspective, it does present some challenges. (external network switches relearning mac quickly is one concern too.)

Anyhow I was wondering if there was an way to configure an “age” timer or some way to delay reuse of the mac until X minutes after release?

I found this older post from 2016 asking similar question:

> [@Network: do not reuse MAC until range is used up](https://forum.opennebula.io/t/network-do-not-reuse-mac-until-range-is-used-up/2914):
>
> Hi, I have a virtual network defined as Ethernet to use our local DHCPd. Basically this works like a charm but we have one little issue with the way the MACs are assigned. As soon as a MAC gets free again it gets reused for the next instance which is correct and working. There is just this little annoyance that we set our host names based on the MAC which leads to new guests showing up with the name of the old one. This is technically correct and working but leads to some user irritations when…

At that time the suggestion was to use an external IPAM tying it to the vnet pool with OpenNebula IPAM Driver.

> **[IPAM driver — OpenNebula 6.10.4 documentation](https://docs.opennebula.io/6.10/integration_and_development/infrastructure_drivers_development/devel-ipam.html)**

Since that was back in 2016, I thought of checking if that is still solution or is there any new configurable on OpenNebula vnet pool side? (I couldn’t find one.)

Thanks for you time and suggestions,

–Ken

---

<div class="post-metadata">

**Author:** ![FrancJP](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/francjp/32/7690_2.png) [@FrancJP](https://forum.opennebula.io/u/FrancJP)\
**Post date:** [March 3, 2025, 12:11pm UTC](https://forum.opennebula.io/t/vnet-mac-pool-reuse-too-quickly/13621/2 "2025-03-03T12:11:12Z")

</div>

Hello @kemcfarl,

The link to the documentation refers to the 6.10 version, so the solution from 2016, is still valid 😉

Other option would be expand the MAC range address, or manually assign MAC addresses (which at some point could be hard to scale).

I’ve found a similar issue open: [Ease setting custom MAC address for VMs · Issue #6804 · OpenNebula/one · GitHub](https://github.com/OpenNebula/one/issues/6804)  
So you if you think it makes sense to comment on it, and also suggest a timer or something like rules for assigning addresses, you are more than welcome to participate.

Cheers,

---

<div class="post-metadata">

**Author:** ![kemcfarl](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kemcfarl](https://forum.opennebula.io/u/kemcfarl)\
**Post date:** [March 3, 2025, 2:50pm UTC](https://forum.opennebula.io/t/vnet-mac-pool-reuse-too-quickly/13621/3 "2025-03-03T14:50:03Z")

</div>

HI @FrancJP ,

Thanks for confirming the current solutions.  
As for expanding the MAC range, that will not help. The size of the pools isn’t the issue, its related to it reusing the same mac immediately after its released/free.

We’ll explore how best to avoid this, but wanted to be sure there wasn’t a newer option available that I was missing.

Once again thank you for your time and this wonderful Open Nebula product.

–Ken

---

<div class="post-metadata">

**Author:** ![atodorov\_storpool](https://yyz1.discourse-cdn.com/flex031/user_avatar/forum.opennebula.io/atodorov_storpool/32/5327_2.png) [@atodorov\_storpool](https://forum.opennebula.io/u/atodorov_storpool)\
**Post date:** [March 6, 2025, 11:46am UTC](https://forum.opennebula.io/t/vnet-mac-pool-reuse-too-quickly/13621/4 "2025-03-06T11:46:18Z")

</div>

Hi,

Could you try using the [VM hooks](https://docs.opennebula.io/6.10/integration_and_development/system_interfaces/hook_driver.html)?

In general, when a VM is terminated (the DONE state), a hook could be triggered to tag the VM MACs in the VNet AR as reserved. This way, the MAC will not be offered to other VMs… Well, you’d need to have a periodic script to release the reservations so as not to exhaust the entire AR. However, how frequently reservations are to be released depends on the use case.

Hope this helps,

Best Regards,  
Anton Todorov

---

<div class="post-metadata">

**Author:** ![kemcfarl](https://avatars.discourse-cdn.com/v4/letter/k/d78d45/32.png) [@kemcfarl](https://forum.opennebula.io/u/kemcfarl)\
**Post date:** [March 6, 2025, 3:28pm UTC](https://forum.opennebula.io/t/vnet-mac-pool-reuse-too-quickly/13621/5 "2025-03-06T15:28:26Z")

</div>

HI,  
Thank you for a 2nd Suggestion. We’ll consider this too.

–Ken
