I've got a complicated and crazy set of circumstances I need to understand and work out a solution for.

Background: We release our product as a virtual appliance via OVFs. With our next-generation product I use packer to generate a gold image, and I give it a interfaces file with the adapter name ens160. Everything works fine there. However, we have an older product that we release the same way, except I don't have a packer script for it. I was previously using a vm that I put the changes on, then export it as an OVF.

Last week we had to do a bugfix for the old product. When I tried to export the OVF, the vcenter host it was on crapped out and wouldn't export it. So I moved it to the other host, which is where I build the packer based project.

The original machine had an ens160 name also, but when I migrated it to the other host, the name changed to ens32 and the networking service said ens160 isn't a valid name. But I KNOW ens160 is a valid name on this host. Listing the logical address only shows ens32.

Why did it change? How can I force it to use ens160 or have it generate the interfaces file at start up with the proper interface name? I'm having real trouble understanding the predictable network interface name thing. It doesn't seem very predictable.

  • Okay, there are at least 2 questions here. "Why did it change" is a function of your virtual host environments. Not a simple answer without more information. The question " How can I force it to use ens160 or have it generate the interfaces file at start up with the proper interface name?" is a simpler question to answer, it is 'systemd's Predictable Network Interface Names'. – jc__ Aug 20 '18 at 18:32
  • 1
    Look at the part on my answer that setup the interface name for help. BTW: If your MAC address changes, leave out the custom interface rule. This way the first nic will always be eth0. – jc__ Aug 20 '18 at 18:37
  • @jc__ I had actually already ended up using your solution as a "quick-n-dirty" solution to get this out the door. – Kevin Milner Aug 20 '18 at 18:40
  • If you export the VMs and keep the MAC address on import, kinda depends on who imports the VM, a rule would work to keep the name custom... I have found that just deleting the rule, and as long as I only have a single nic on my VM eth0 works fine. – jc__ Aug 20 '18 at 18:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.