Disable a network interface in Arch Linux

10,494

Solution 1

Are they the same kind of chipset or different ones?

If they are differnt then probably the simplest solution would be to just blacklist the modules for that Ethernet chipset.

You will first need to find the module name (this is for eth0):

dmesg | grep eth0

See if you have something like the following:

[    2.209295] r8169 0000:05:00.0: eth0: RTL8168d/8111d at 0xffffc90000c6e000, 00:24:1d:11:b6:64, XID 081000c0 IRQ 44

In my case 'r8169' is the module name. You can also see a list of currently loaded modules with 'lsmod' so check that it appears in there.

Next you need to black list the module. There is an entry on the Arch wiki for that.

Solution 2

Fellow archer here; I have a method I use to disable my nVidia graphic card's HDMI port audio chip based on its hardware pci id; perhaps you could apply the same approach to your nic:

Find the ethernet's pci id:

$ lspci | grep Eth
00:19.0 Ethernet controller: Intel Corporation 82579V Gigabit Network Connection (rev 05)

Find the corresponding directory:

$ find /sys/devices -name *00:19.0
/sys/devices/pci0000:00/0000:00:19.0

There should be a file named "remove" in that directory. You can disable the device at startup by editing /etc/rc.local

echo 1 > /sys/devices/pci0000:00/0000:00:19.0/remove

On second thought; this may not work in your case if modules get loaded prior to /etc/rc.local finishing... it would do you little good to have /dev/eth0 and /dev/eth1 assigned in the "wrong" order and then have /etc/rc.conf disable one of them... you could still end up with your prefered nic as eth1. This used to be a problem with alsa on multiple sound cards so methods were devised to assign the numbering of the cards via module parameters. Perhaps the module itself allows this?

Solution 3

I'm gathering from your description this in an onboard NIC. The best solution would be to disable it in the motherboard BIOS rather than the OS. The method for this varies by manufacturer but I'm sure you could find a manual for your model online somewhere.

Solution 4

I'm confused it didn't show up: In case you don't need the low level solution proposed by cjpembo, you can just use

ip link set dev <interface name> down

You get them via ip link show.

Share:
10,494
Heldraug
Author by

Heldraug

Updated on July 01, 2022

Comments

  • Heldraug
    Heldraug almost 2 years

    I have the following problem. My PC is very old and it has a built in ethernet port that doesn't work, not due to a misconfiguration, I think it's physically damaged. It didn't work in either Ubuntu or even on Windows. I have an ethernet PCI card which is the one I use. The problem is, for some odd reason, the card that does works sometimes changes from eth0 to eth1 and I have to run dhcpd as I don't always get an IP via DHCP. Now, the actual question is, is there some way to disable the card that doesn't work using its MAC address or something? I can't disable either eth0 or eth1 as I'm sure it's not always "pointing" to the same card.

  • Heldraug
    Heldraug over 12 years
    I didn't think about disabling it from the BIOS. The other answered solved my problem but I think you're right. Thank you for your answer.
  • Heldraug
    Heldraug about 12 years
    I don't have anymore that computer, so I'm afraid that I can't test that anymore, but actually it makes sense. Thank you very much.