Ubuntu – My ethernet interface name has changed from eth0 to eth1

interfacenetworkingudev

I was doing some work in GNS3 in which I had to run a Virtual machine(tiny version of OS) and needed to connect that machine to a virtual router that was running also on GNS3. For this I needed to set an ip address in one of my interfaces(eth0).

After I close GNS3, and failed to get internet from port. I also found that my Ethernet interface name has changed from eth0 to eth1.

I think that is the reason I am not getting internet form my LAN port.

I deleted that project in GNS3 but problem persists.

Is there any way to change it again to eth0 ?

Best Answer

  • You need to modify the udev rule for the network interface to change the name. As seen in the /etc/udev/rules.d/70-persistent-net.rules file:

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

    the name has been changed to eth1.

    To change the name of the interface back to eth0:

    • Open the file /etc/udev/rules.d/70-persistent-net.rules with your favorite editor

    • Find the rule matching your MAC address

    • Change the NAME value from eth1 to eth0 i.e. NAME="eth0"

    • To apply changes without restarting run sudo udevadm trigger

  • Related Question