LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   MAC Address out of sync (https://www.linuxquestions.org/questions/linux-newbie-8/mac-address-out-of-sync-4175731568/)

fusion1275 12-06-2023 04:23 AM

MAC Address out of sync
 
Hi all,

I have been working on this problem for some time now and it has just totally baffled me. I am hoping someone has some ideas to throw my way please.

So I am using Hashicorp Packer and Ansible to create an Azure-arm image. Packer builds it and Ansible provisions with certain software packages required. When I build a new vm from this completed image in Azure I log in and can see that interface eth0 has a mac address that Azure has provided it via it's build process but in /etc/sysconfig/network-scripts/ifcfg.eth0 it has a variable of HWADDR which has the mac address which was used when I built the Azure image and it got packaged up.

So I get a networking conflict and certain things fail to work out of the box! I might also add that the new vm is a product of ours and it kicks off a registration process upon first boot. If the machine is rebooted without this registration being complete will result in the vm's specific software failing. So rebooting is not an option whatsoever.

I would just like to know how to get the mac addresses in line. I've tried certain blocks in Ansible to disable cloud-init or even try to stop it controlling the mac address assigning. I've also tried post-processor code blocks in Packer. All of which result in the vm being unusable and me not even being able to log into the thing to start the registration.

OS used is Oracle Linux 8.x

Error in /var/log/messages
Code:

error="process update config file: could not save updated config for interface 'eth0': exit status 7: Error: Connection activation failed: No suitable device found for this connection (device eth0 not available because profile is not compatible with device (permanent MAC address doesn't match))
Thanks to anyone who has time to look at this and help. Much appreciated.

smallpond 12-06-2023 09:15 AM

Why can't you use the MAC provided by Azure?

fusion1275 12-06-2023 10:00 AM

I want to use the Azure mac address but from the point of an image being created with the locked in mac address to the point where a new vm is created and Azure provisions a new mac address I am at a loss.

I have no idea how to approach this issue. As said before I have tried to disable all sorts of things in the build of the image to hopefully spit out something so a new image won't have a mac set. But this then stops the internal network from working and therefore I am unable to get to a browser page to start that registration.

How can I enforce Azure to use the provided mac address in all new vm's created from the image?

wpeckham 12-06-2023 12:07 PM

Quote:

Originally Posted by fusion1275 (Post 6468771)
I want to use the Azure mac address but from the point of an image being created with the locked in mac address to the point where a new vm is created and Azure provisions a new mac address I am at a loss.

I have no idea how to approach this issue. As said before I have tried to disable all sorts of things in the build of the image to hopefully spit out something so a new image won't have a mac set. But this then stops the internal network from working and therefore I am unable to get to a browser page to start that registration.

How can I enforce Azure to use the provided mac address in all new vm's created from the image?

No sane network engineer would want to do that. If you were to bring two images up on the same network with the same MAC the network routing would freak. Depending upon your network devices, it could shut the entire network down. More likely one the the images would simply not network because the routing would only route packets to the first or last path containing that MAC. Remember: at the hardware/firmware level it is the MAC that packets are directed to, not the IP address. Duplication can be BAD in this case.

OF course, you can take steps to ensure that these images always come up on different networks entirely and never on the same router. Why would you want to jump through those hoops? Where would be the advantage?


All times are GMT -5. The time now is 05:10 PM.