My ethernet interface name has changed from eth0 to eth1

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 ?

3

3 Answers

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

8

first, SU -l into root then perform the following:

cd /etc/sysconfig

ls

cd network-scripts/

ls

vi ifcfg-eth0

VI is an editor that is very dangerous lol, but be careful to not change anything unless that is the objective.

For ubuntu 16.04 and above you should not use KERNEL=="eth*". So you should just use

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

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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

You Might Also Like