Reset or Swap Network Interface Names?

I recently restored a system image from a working freePBX system running on a Dell Optiplex 755 to a Dell Optiplex 745 with similar hardware (2 NICs) that I use for testing purposes.

After restoring the system image to the 745, for some reason the OS is enumerating the onboard Ethernet adapter as eth1 and the PCI Ethernet adapter as eth0.

Is there a way to have the Linux operating system do a reset and re-scan of all hardware? Or, is there a way with the Sangoma Linux 7 to rename/swap the eth0 and eth1 interfaces? I know if I did a complete fresh install on the 745 it would enumerate the interfaces correctly (in order) during setup and initial boot, but I prefer not to lose everything contained/configured in this system image.

So far I have tried removing and reinserting the PCI network adapter, but it always comes back as eth0. I’ve also tried specifying the MAC address in the ifcfg-ethx files by specifying the HWADDR= option in the config files, but the network services will not start because the MAC addresses do not match the hardware addresses detected by the kernel.

I tried following these steps to rename the interfaces here:

location of 70-persistent-net.rules in Centos 7
and
How do I change eth1 to eth0?

but my suspicion is that the 70-persistent-net.rules file no longer works or pertains to the Sangoma Linux 7 distribution.

Now this site looks more promising, but I do not know exactly what to replace the <module> entries with in the /etc/modules.conf file for the aliases:
Network interfaces assignment problem

I apologize for the lack of experience when it comes to basic Linux skills; I come mainly from a MS environment, and in Windoze, a simple uninstall and reinstall of the network adapters from the Device Mangler followed by a few netsh commands and the adapters would be installed in numerical order.

  1. Change name eth0 and eth1 in /etc/udev/rules.d/70-persistent-net.rules file
  2. then change the ifcfg-eth0 and ifcfg-eth1 files in /etc/sysconfig/network-scripts folder
  3. service network restart

Have a good day ^^;;

Thank you for your reply! Unfortunately I tried what you suggested but it did not work. On the system in question, the 70-persistent-net.rules file does not exist in the /etc/udev/rules.d folder. I did create this file though and gave the user root full permissions. If this file/method works on the Sangoma Linux version 7, perhaps I don’t have the right items configured in the file?

This is what I put in the 70-persistent-net.rules file:

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="MAC_ADDRESS_OF_ETH0", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"

SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="MAC_ADDRESS_OF_ETH1", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth1"

replacing MAC_ADDRESS_OF_ETHx" with the corresponding MAC address of the interface.

When you say

do you mean specify the DEVICE=ethx within the config file? Do I need to include the HWADDR= as well?

If you refer to the link below, you will be able to solve it. ^^ :+1:

Following the link provided, I removed the /etc/udev/rules.d/70-persistent-net.rules file and ran

udevadm trigger --type=devices --action=change and

udevadm control --reload-rules

but they never re-generated the file. So I restored the file I originally created, ran the two commands again, and even rebooted, and still no success.

From the link provided, I also even tried creating the /lib/udev/write_net_rules file and added:

# line 25, line 26 is next
INTERFACE=eth0 # provided this is your interface
MATCHADDR="d4:AE:52:AB:AC:AD" # add your real mac address, not this fake one of course

and still no luck. :frowning:

Does anyone else have anything to suggest/try? So far I have gone as far as restoring the image to the system again, but without the second PCI network card installed. With the card not installed, the onboard Ethernet adapter gets properly enumerated as eth0. But as soon as I add the PCI network card in, all Hell breaks loose.

Is there a command that I can run that can re-scan the hardware similar to how the setup iso runs on initial install of FreePBX?

How does the setup enumerate and install devices during the initial install? Or is it left up to the operating system somehow and cannot be controlled or modified?

I’m still at a loss here, and I am thinking of just using VMWare Converter to make a virtual machine of the production machine and go from there, but unfortunately I currently don’t have any USB-to-Ethernet adapters. :slightly_frowning_face:

Any help is greatly appreciated. :slightly_smiling_face:

More Information:
Seeing this post here by @dicko that points to the same Red Hat site that @kunter posted above here, it appears that my particular installation is missing some of the udev rpms required for generating the .rules file. I ran the following commands to install them onto the installation:

yum install udev
yum install libgudev1
yum install python-gudev

I was unable to install the libudev however. Not sure if this might be required?

Lastly, I noticed this comment on the Red Hat site, which leads me to believe that this may still be an issue here in 2023 :roll_eyes: :

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.