You are not logged in.

#1 2023-08-13 12:27:46

Xenfo
Member
From: Montreal, QC
Registered: 2021-11-06
Posts: 39
Website

[SOLVED] How do I disable a network card

I have 2 network cards and I'd like to disable one of them by its address (d4:54:8b:6a:d8:30) instead of its name (wlan1). I tried "ip link set wlan1 down" but it's up again on the next restart. Is there also any way to prevent the network cards from switching names with each other? wlan1 was wlan0 yesterday and vice versa.

Last edited by Xenfo (2023-08-14 14:15:26)

Offline

#2 2023-08-13 13:22:05

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,112

Re: [SOLVED] How do I disable a network card

This is actually what https://wiki.archlinux.org/title/Networ … face_names is for, but it's disabled when you use iwd because that conflicts with it.
Either of

ip -o l | awk -F '[ :]' '/d4:54:8b:6a:d8:30/{print $3}'
ip -o l | sed '/d4:54:8b:6a:d8:30/!d; s/[0-9]*: \(wl[^:]*\): .*/\1/g'

will extract you the device, though.

Is this an xy-problem? Are you trying to down the device to "hide" it from iwd?

Offline

#3 2023-08-13 13:26:42

mpan
Member
Registered: 2012-08-01
Posts: 1,600
Website

Re: [SOLVED] How do I disable a network card

As for the second part: since version 197 systemd supports predictable network interface names (short intro). These names are not absolutely stable for some arbitrary definition of stability, but they are bound to logical location of the hardware, which should be good enough for your purpose.

You may also use udev to set a device name explicitly to whatever you want it to be. Either directly with the rules (matching by “address” attribute and using `NAME=` assignment) or using the systemd’s link mechanism (matching by `MACAddress`, renaming by setting `Name` in the `link` section).


Paperclips in avatars? | Sometimes I seem a bit harsh — don’t get offended too easily!

Offline

#4 2023-08-13 13:36:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,112

Offline

#5 2023-08-13 16:16:18

Xenfo
Member
From: Montreal, QC
Registered: 2021-11-06
Posts: 39
Website

Re: [SOLVED] How do I disable a network card

seth wrote:

This is actually what https://wiki.archlinux.org/title/Networ … face_names is for, but it's disabled when you use iwd because that conflicts with it.
Either of

ip -o l | awk -F '[ :]' '/d4:54:8b:6a:d8:30/{print $3}'
ip -o l | sed '/d4:54:8b:6a:d8:30/!d; s/[0-9]*: \(wl[^:]*\): .*/\1/g'

will extract you the device, though.

Is this an xy-problem? Are you trying to down the device to "hide" it from iwd?

Not necessarily hide it but just disable it from being used and trying to connect to WiFi since it's no longer needed since I have the other WiFi card.

Offline

#6 2023-08-13 16:20:44

growler
Member
Registered: 2022-09-26
Posts: 25

Re: [SOLVED] How do I disable a network card

Xenfo wrote:

I have 2 network cards and I'd like to disable one of them by its address (d4:54:8b:6a:d8:30) instead of its name (wlan1). I tried "ip link set wlan1 down" but it's up again on the next restart. Is there also any way to prevent the network cards from switching names with each other? wlan1 was wlan0 yesterday and vice versa.

Take blacklist?
https://bbs.archlinux.org/viewtopic.php?id=220177

Last edited by growler (2023-08-13 16:23:26)

Offline

#7 2023-08-13 17:15:35

Xenfo
Member
From: Montreal, QC
Registered: 2021-11-06
Posts: 39
Website

Re: [SOLVED] How do I disable a network card

They are both Intel cards so wouldn’t that disable both of them?

Offline

#8 2023-08-13 17:29:25

growler
Member
Registered: 2022-09-26
Posts: 25

Re: [SOLVED] How do I disable a network card

Xenfo wrote:

They are both Intel cards so wouldn’t that disable both of them?

The kernel drivers are the same? ... lspci -k
If so, the blacklist is wrong.

Offline

#9 2023-08-13 18:01:34

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 76,112

Re: [SOLVED] How do I disable a network card

You could possibly use a udev rule to rfkill it rather than bring it down and leverage the sample of the "semi-predictable" rename rule.
(But idk. how well iwd will respond to that)

Offline

#10 2023-08-13 18:12:01

loqs
Member
Registered: 2014-03-06
Posts: 18,931

Re: [SOLVED] How do I disable a network card

Xenfo wrote:

Not necessarily hide it but just disable it from being used and trying to connect to WiFi since it's no longer needed since I have the other WiFi card.

If the card you want to prevent being used came with the motherboard/system there may be a firmware option to disable it.
There is also the approach of binding the device to another driver for instance pci-stub.

Offline

#11 2023-08-13 23:35:29

Xenfo
Member
From: Montreal, QC
Registered: 2021-11-06
Posts: 39
Website

Re: [SOLVED] How do I disable a network card

growler wrote:
Xenfo wrote:

They are both Intel cards so wouldn’t that disable both of them?

The kernel drivers are the same? ... lspci -k
If so, the blacklist is wrong.

Yes, they both use iwlwifi since they are both Intel cards.

loqs wrote:
Xenfo wrote:

Not necessarily hide it but just disable it from being used and trying to connect to WiFi since it's no longer needed since I have the other WiFi card.

If the card you want to prevent being used came with the motherboard/system there may be a firmware option to disable it.
There is also the approach of binding the device to another driver for instance pci-stub.

No firmware option to disable it (MSI being MSI) and not sure what you mean by the second part.

Offline

#12 2023-08-14 01:19:08

loqs
Member
Registered: 2014-03-06
Posts: 18,931

Re: [SOLVED] How do I disable a network card

Xenfo wrote:

not sure what you mean by the second part.

You would add the following kernel parameter replacing VID:PID with the correct values

pci-stub.ids=VID:PID

Offline

#13 2023-08-14 13:51:25

shulamy
Member
From: israel
Registered: 2010-09-11
Posts: 468

Re: [SOLVED] How do I disable a network card

bios ?

ezik

Offline

#14 2023-08-14 14:09:34

Xenfo
Member
From: Montreal, QC
Registered: 2021-11-06
Posts: 39
Website

Re: [SOLVED] How do I disable a network card

shulamy wrote:

bios ?

ezik

I missunderstood a previous post about disabling it with firmware but I don't think I can with iwlwifi. I do not have an option to disable it in BIOS though.

Offline

#15 2023-08-14 14:15:09

Xenfo
Member
From: Montreal, QC
Registered: 2021-11-06
Posts: 39
Website

Re: [SOLVED] How do I disable a network card

I was actually mistaken, my BIOS does support it, it was just weirdly named. Marking this as solved.

Offline

Board footer

Powered by FluxBB