Ethernet NIC Issues and my experiences

This time I discuss how you might disable an Ethernet NIC that you may not want configured.

A few months ago I added a Trendnet PCIx4 10gig Ethernet device on my Dell desktop computer. I bought this NIC on Amazon which I have linked here.

I have both the 1gig motherboard integrated Qualcomm NIC and the new 10gig NIC connected to switch ports in my Home Lab. When the system boots, the integrated 1G NIC and the 10gig NIC do not enumerate on the PCIx bus in the same order every time. This results in devices enp3s0, enp4s0 and sometimes enp5so being configured. Despite a great netplan configuration file, the device names are not always matched to the correct NIC.

I want both NICs to have switch connections because I PXE boot the desktop into iVentoy at times to boot other OS images and I use RedoRescue as I have discussed before. Unfortunately PXE booting is only supported on the integrated motherboard NIC and so that’s why I have not disabled it in the BIOS or removed the cable to the switch.

Considering the random naming of the two NIC devices and the fact that for normal booting I really only need the 10gig NIC to be operational, I came up with a solution and that’s what this tutorial is about.

As shown in the video, I have the Integrated Qualcomm Atheros 1g NIC and the Trendnet (Aquantia) 10g NIC on this system.

image

The gnome extension I use to display my LAN address on the top bar can be found here.

Here you can see a Network Manager GUi view of both devices.

By clicking on the gear, I can identify the 1g Qualcomm device.

image

I can identify both devices at the command line.

ifconfig

Per my netplan configuration, enp4s0 is not assigned an IP address and it serves as the parent device for the bridge0 software virtual switch. This is the 10gig device.

The device named enp3s0 is configured in my netplan configuration to not get an address and you see here that it got the address 172.16.1.224 from my DHCP server and that is also the listed LAN address in the Gnome extension on the top panel.

The reason for this is because at the last bootstrap, that device was enp5s0. This occurs due to PCIx bus enumeration order not always being the same.

The way to remove the 1g adapter from the current configuration is by setting its state to down:

sudo ip link set enp3s0 down

After that the enp3s0 device doesn’t show in the configuration:

ifconfig

This also had the effect of correctly showing the 172.16.1.225 address for bridge0 on the gnome top panel extension:

image

If we click the menu pull down, it also does not list the Qualcomm device.

image

At this point if we go into network settings, Network Manager reports that the “downed” interface has an unplugged cable which is what we expect. Perhaps “unplugged” is not as clear as it should be since the cable is still plugged in physically.

This would seem to be a solution. Unfortunately, the device comes back online after the next reboot. You might wonder why I did not do:

sudo iw dev enp3s0 del

The reason is that command is only supported for virtual devices and not for physical hardware.

We can begin to see the solution by listing the devices on the PCI bus where we can see both Ethernet adapters.

lspci

To get a detailed verbose listing of our devices:

lspci -vvv

Notice that the Qualcomm 1g NIC loads a kernel module called “alx”.

We can edit the kernel module blacklist with the following command:

sudo nano /etc/modprobe.d/blacklist.conf

At the bottom of this file, I add a comment and an entry to not load the “alx” kernel module for the Qualcomm NIC:

# Disable Qualcomm 1G NIC on bootstrap
blacklist alx

So, the file looks like this:

I do a CTRL O and enter to write out the file and a CTRL X to exit the nano editor.

In order to update the CPIO compressd archive for the initramfs memory disk image:

sudo update-initramfs -u

Initramfs is the initial kernel files loaded to a RAM disk before control is transferred to the root on your main file system.

Reboot your system to see the new configuration take effect.

sudo reboot now

After the reboot, you will see that the Gnome top panel extension has the 172.16.1.225 address of bridge0 and that there is only one Ethernet device in the menu.

image

If I go into settings, there is no “unplugged” device since the Qualcomm device was not configured to begin with. The single device listed is the 10g NIC.

Likewise, the ifconfig command will only list the bridge0 device and its 10g parent enp4s0.

Even though the kernel module is not loaded, you can still see the device on the PCI bus.

lspci