After removing or adding graphic cards ( I assume it's true for any PCIe device ) my network interface always changes name. From something like enp4s0 to enp3s0. Tested on multiple devices, with 18.04 and 19.04, same thing. After doing some research I found out this might be normal ? (confirmation required)

Anyways if it's not a bug, I have to reconfigure my netplan every time I boot up. I never had such a problem in past with good old networking. Either it always recognized my Ethernet card or name didn't change, but it worked.

I edited my netplan config to this :

        dhcp4: true
        dhcp4: true
        dhcp4: true
        dhcp4: true
        dhcp4: true
version: 2

It works for configurations I can get, but this definitely is not the solution, more of a workaround.


In theory you can configure your networking based on macaddress matching and specify the name for the interface that way.

This is a potential configuration that might work for your needs, assuming you can get the MAC Address for your interface and put it in for the mac address below:

  version: 2
  renderer: networkd
        macaddress: "de:ad:be:ef:ca:fe"
      dhcp4: true

This will define the network interface name as eth0 which is the old naming convention, but should work regardless of the name set up by predictive interface naming.

This configuration is partially based off of this example in the Netplan examples documentation but with dhcp4 spin on it (and no VLANs). (This is an untested solution on my part, however, so if this does not solve the issue for you I will remove this answer.)

  • 1
    I think it's working - I didn't test with moving around any PCIe cards, but after rebooting it connected to network just fine and the interface shows up as eth0. Thanks – John Dec 2 at 15:18
  • @John Glad to hear it! Let me know when you test moving cards around, see if the ifname stays eth0 and networking still works. As configured it should "Just Work" per my understanding of the Netplan system, but your mileage with this may vary which is why I still state the solution is 'untested' – Thomas Ward Dec 2 at 15:32
  • Done some testing with moving cards, multiple devices ... All works really good. Wondering why this isn't default configuration for netplan, much harder to screw it up. I guess this was default for ifupdown since I never run into this on older Ubuntu versions ? – John Dec 2 at 19:01
  • set-name is not needed in order to match (you can call your interface 'eth0' in netplan just fine without changing the interface name in the kernel, it's just a label), and I would discourage this unless you are layering other software on top of it (firewall tools, etc) which needs the interface name to not change. – slangasek Dec 3 at 0:52
  • @slangasek Edited – Thomas Ward Dec 3 at 1:01

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.