network.managed sets wrong mac addresses for bonded NICs
When network.managed runs for an interface on a Red Hat-ish system, it creates the ifcfg-ethX file and in that file places the HWADDR line containing that interface's hardware address.
However, when a link bond is created (at least in LACP mode under the default settings), all interfaces in the bond are assigned the mac address of the first interface. If the salt state runs network.managed for any slave interface, it will write that changed mac address to the ifcfg-ethX file. The end result is every ifcfg-ethX file has the same HWADDR in it, and the next time the machine boots it will refuse to process the ifcfg-ethX file because the HWADDR is incorrect.
I don't have a good suggestion for how to fix this. Maybe detect the interface is a slave and don't set the HWADDR? Or use a different method to detect the permanent hardware address? Or give an option to network.managed to not set the HWADDR for a given interface, and users can set that on bond slaves?
Thanks for the report. I'm not sure what the solution here is either. In any case, we'll figure it out.
I've found this as well, and it makes managing bonded interfaces a nightmare with salt's network.managed module.
If you can't find another solution, at worst you could make an external call to from within the module code to ethtool, e.g.
ethtool -P eth4 | awk '{print $3}' 00:0f:53:0c:3d:7c
which is the correct hardware address of a bonded interface where ifcft and ip addr report the bonded value, which of course is different (and wrong).
I'm having this same issue now. Slave interfaces are getting what appears to be a bogus MACs and they're not working at all.
Simply removing the HWADDR line from the ifcfg-bondX file and bouncing the network stack fixes the issue.
Is there any way we can just get a method for disabling the HWADDR changes to an interface?
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
If this issue is closed prematurely, please leave a comment and we will gladly reopen the issue.