Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

udev - set persistent name for WLAN Adapter

512 views
Skip to first unread message

csan...@gmail.com

unread,
Apr 25, 2015, 3:40:04 PM4/25/15
to
Hello,

on my Wheezy system I just can't set a persistent 'wlan0' name for my
USB WiFi apadter.

In /etc/udev/rules.d/70-persistent-net.rules I have the line:
# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="usb", ACTION=="add", DRIVERS=="usb",
ATTRS{idVendor}=="0586", ATTRS{idProduct}=="341f", ATT
R{manufacturer}=="Realtek", ATTR{product}=="802.11n WLAN Adapter",
ATTR{dev_id}=="0x0", ATTR{type}=="1"
, KERNEL=="wlan*", NAME="wlan0"

I did run:
# udevadm control --reload-rules

After that, when I replug the WLAN Adapter, I get in
70-persistent-net.rules another line:
# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:e0:4c:81:92:e7", ATTR{dev_id}=="0x0"
, ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"

and after another replugging I get:
# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
ATTR{address}=="00:e0:4c:81:92:77", ATTR{dev_id}=="0x0"
, ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan2"

So what am I missing here?
Why can't I set a persistent name for my WLAN Adapter?

--
Regards from Pal



--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/877ft0x...@gmail.com

Pascal Hambourg

unread,
Apr 25, 2015, 4:40:03 PM4/25/15
to
csan...@gmail.com a écrit :
>
> on my Wheezy system I just can't set a persistent 'wlan0' name for my
> USB WiFi apadter.
>
> In /etc/udev/rules.d/70-persistent-net.rules I have the line:
> # USB device 0x:0x (rtl8192cu)
> SUBSYSTEM=="usb", ACTION=="add", DRIVERS=="usb",
> ATTRS{idVendor}=="0586", ATTRS{idProduct}=="341f", ATT
> R{manufacturer}=="Realtek", ATTR{product}=="802.11n WLAN Adapter",
> ATTR{dev_id}=="0x0", ATTR{type}=="1"
> , KERNEL=="wlan*", NAME="wlan0"

Shouldn't ATTRS be used with {manufacturer} and {product} instead of
ATTR ? Besides, are they really useful ? Shouldn't it be enough to match
the USB vendor and product IDs ?

> After that, when I replug the WLAN Adapter, I get in
> 70-persistent-net.rules another line:
> # USB device 0x:0x (rtl8192cu)
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{address}=="00:e0:4c:81:92:e7", ATTR{dev_id}=="0x0"
> , ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"
>
> and after another replugging I get:
> # USB device 0x:0x (rtl8192cu)
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{address}=="00:e0:4c:81:92:77", ATTR{dev_id}=="0x0"
> , ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan2"

Weird that the interface has a different MAC (although very similar)
address each time.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/553BF704...@plouf.fr.eu.org

songbird

unread,
Apr 25, 2015, 4:50:04 PM4/25/15
to
i'm not sure if the above is the exact entry, but if it
is the entry should be all on one line.

i don't use the dev_id or kernel bits (not sure if this
matters).


songbird


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/3s9t0c-...@ID-306963.user.uni-berlin.de

csan...@gmail.com

unread,
Apr 25, 2015, 6:10:04 PM4/25/15
to
songbird <song...@anthive.com> writes:

> csan...@gmail.com wrote:
>> Hello,
>>
>> on my Wheezy system I just can't set a persistent 'wlan0' name for my
>> USB WiFi apadter.
>>
>> In /etc/udev/rules.d/70-persistent-net.rules I have the line:
>> # USB device 0x:0x (rtl8192cu)
>> SUBSYSTEM=="usb", ACTION=="add", DRIVERS=="usb",
>> ATTRS{idVendor}=="0586", ATTRS{idProduct}=="341f", ATT
>> R{manufacturer}=="Realtek", ATTR{product}=="802.11n WLAN Adapter",
>> ATTR{dev_id}=="0x0", ATTR{type}=="1"
>> , KERNEL=="wlan*", NAME="wlan0"

> i'm not sure if the above is the exact entry, but if it
> is the entry should be all on one line.

Actually it is all on one line in the 70-persistent-net.rules file .

I should wrote here like:
# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="usb", ACTION=="add", DRIVERS=="usb", \
ATTR{idVendor}=="0586", ATTR{idProduct}=="341f", \
ATTR{manufacturer}=="Realtek", \
ATTR{product}=="802.11n WLAN Adapter", ATTR{dev_id}=="0x0", \
ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

--
Regards from Pal


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/871tj7y...@gmail.com

csan...@gmail.com

unread,
Apr 25, 2015, 6:30:03 PM4/25/15
to
csan...@gmail.com writes:

> songbird <song...@anthive.com> writes:
>
>> csan...@gmail.com wrote:
>>> Hello,
>>>
>>> on my Wheezy system I just can't set a persistent 'wlan0' name for my
>>> USB WiFi apadter.
>>>
>>> In /etc/udev/rules.d/70-persistent-net.rules I have the line:
>>> # USB device 0x:0x (rtl8192cu)
>>> SUBSYSTEM=="usb", ACTION=="add", DRIVERS=="usb",
>>> ATTRS{idVendor}=="0586", ATTRS{idProduct}=="341f", ATT
>>> R{manufacturer}=="Realtek", ATTR{product}=="802.11n WLAN Adapter",
>>> ATTR{dev_id}=="0x0", ATTR{type}=="1"
>>> , KERNEL=="wlan*", NAME="wlan0"
>
>> i'm not sure if the above is the exact entry, but if it
>> is the entry should be all on one line.
>
> Actually it is all on one line in the 70-persistent-net.rules file .
>
> I should wrote here like:
> # USB device 0x:0x (rtl8192cu)
> SUBSYSTEM=="usb", ACTION=="add", DRIVERS=="usb", \
> ATTR{idVendor}=="0586", ATTR{idProduct}=="341f", \
> ATTR{manufacturer}=="Realtek", \
> ATTR{product}=="802.11n WLAN Adapter", ATTR{dev_id}=="0x0", \
> ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

I have found the solution:
# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
ATTR{address}=="00:e0:4c:81:92:*", ATTR{dev_id}=="0x0", \
ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

I don't use neither
ATTR{idVendor}=="0586", nor
ATTR{idProduct}=="341f"

and it still works.
Why?

--
Regards from Pal


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/87vbgjx...@gmail.com

Michael Biebl

unread,
Apr 25, 2015, 8:10:04 PM4/25/15
to
Am 25.04.2015 um 22:20 schrieb Pascal Hambourg:
> csan...@gmail.com a écrit :

>> After that, when I replug the WLAN Adapter, I get in
>> 70-persistent-net.rules another line:
>> # USB device 0x:0x (rtl8192cu)
>> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
>> ATTR{address}=="00:e0:4c:81:92:e7", ATTR{dev_id}=="0x0"
>> , ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"
>>
>> and after another replugging I get:
>> # USB device 0x:0x (rtl8192cu)
>> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
>> ATTR{address}=="00:e0:4c:81:92:77", ATTR{dev_id}=="0x0"
>> , ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan2"
>
> Weird that the interface has a different MAC (although very similar)
> address each time.

Indeed, that seems to be the root of the problem.
The changing MAC address causes /lib/udev/write_net_rules to create new
entries.

Pal, what hardware is that specifically?
Any idea why it changes the MAC?

--
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?

signature.asc

Bob Proulx

unread,
Apr 25, 2015, 8:40:04 PM4/25/15
to
Michael Biebl wrote:
> Pal, what hardware is that specifically?
> Any idea why it changes the MAC?

Hmm... Is 'macchanger' involved in this in any way?

$ apt-cache show macchanger
Description-en: utility for manipulating the MAC address of network interfaces
Features:
* set specific MAC address of a network interface
* set the MAC randomly
* set a MAC of another vendor
* set another MAC of the same vendor
* set a MAC of the same kind (eg: wireless card)
* display a vendor MAC list (today, 6200 items) to choose from
Homepage: http://www.alobbs.com/macchanger

It is a useful tool. I use it on the wifi device of my laptop. It
isn't without issue to do so but it does what it does well.

Bob
signature.asc

Pascal Hambourg

unread,
Apr 26, 2015, 6:10:04 AM4/26/15
to
csan...@gmail.com a écrit :
>>
>> I should wrote here like:
>> # USB device 0x:0x (rtl8192cu)
>> SUBSYSTEM=="usb", ACTION=="add", DRIVERS=="usb", \
>> ATTR{idVendor}=="0586", ATTR{idProduct}=="341f", \
>> ATTR{manufacturer}=="Realtek", \
>> ATTR{product}=="802.11n WLAN Adapter", ATTR{dev_id}=="0x0", \
>> ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

This is wrong, as I wrote earlier : idVendor, idProduct, manufacturer
and product should use ATTRS instead of ATTR, because these attributes
belong to parent devices, not to the network interface itself.

udevadm info -a -p /sys/class/net/wlan0

> I have found the solution:

Not *the* solution, just *a* solution.

> # USB device 0x:0x (rtl8192cu)
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
> ATTR{address}=="00:e0:4c:81:92:*", ATTR{dev_id}=="0x0", \
> ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
>
> I don't use neither
> ATTR{idVendor}=="0586", nor
> ATTR{idProduct}=="341f"
>
> and it still works.
> Why?

See above : it works now because they would not match. If you remove
criteria, the match is less restrictive (at the risk of matching other
devices too).


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/553CB34A...@plouf.fr.eu.org

David Wright

unread,
Apr 26, 2015, 12:40:04 PM4/26/15
to
Quoting Pascal Hambourg (pas...@plouf.fr.eu.org):
> csan...@gmail.com a écrit :
>
> > After that, when I replug the WLAN Adapter, I get in
> > 70-persistent-net.rules another line:
> > # USB device 0x:0x (rtl8192cu)
> > SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> > ATTR{address}=="00:e0:4c:81:92:e7", ATTR{dev_id}=="0x0"
> > , ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"
> >
> > and after another replugging I get:
> > # USB device 0x:0x (rtl8192cu)
> > SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> > ATTR{address}=="00:e0:4c:81:92:77", ATTR{dev_id}=="0x0"
> > , ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan2"
>
> Weird that the interface has a different MAC (although very similar)
> address each time.

I had a Netgear router that appeared thus:
c4:3d:c7:c2:c1:b4 netgear-adsl-g wlan and eth
c4:3d:c7:c2:c1:b3 netgear-adsl-n wlan

Perhaps it's autoselecting between g and n.

Cheers,
David.


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/20150426161917.GA1069@alum

csan...@gmail.com

unread,
Apr 26, 2015, 2:10:03 PM4/26/15
to
I just installed macchanger and run:
macchanger -s wlan0
Permanent MAC: 00:e0:4c:81:92:dc (Realtek Semiconductor Corp.)
Current MAC: 00:e0:4c:81:92:dc (Realtek Semiconductor Corp.)

# macchanger -m 00:e0:4c:81:92:dc wlan0
Permanent MAC: 00:e0:4c:81:92:dc (Realtek Semiconductor Corp.)
Current MAC: 00:e0:4c:81:92:dc (Realtek Semiconductor Corp.)
It's the same MAC!!

So after this what should I do with udev rules in
70-persistent-net.rules ?

Now the line is:
# USB device 0x:0x (rtl8192cu)
SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
ATTR{address}=="00:e0:4c:81:92:*", ATTR{dev_id}=="0x0", \
ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

--
Regards from Pal


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/87k2wy4...@gmail.com

csan...@gmail.com

unread,
Apr 26, 2015, 2:10:03 PM4/26/15
to
Michael Biebl <bi...@debian.org> writes:

> Am 25.04.2015 um 22:20 schrieb Pascal Hambourg:
>> csan...@gmail.com a écrit :
>
>>> After that, when I replug the WLAN Adapter, I get in
>>> 70-persistent-net.rules another line:
>>> # USB device 0x:0x (rtl8192cu)
>>> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
>>> ATTR{address}=="00:e0:4c:81:92:e7", ATTR{dev_id}=="0x0"
>>> , ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan1"
>>>
>>> and after another replugging I get:
>>> # USB device 0x:0x (rtl8192cu)
>>> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
>>> ATTR{address}=="00:e0:4c:81:92:77", ATTR{dev_id}=="0x0"
>>> , ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan2"
>>
>> Weird that the interface has a different MAC (although very similar)
>> address each time.
>
> Indeed, that seems to be the root of the problem.
> The changing MAC address causes /lib/udev/write_net_rules to create new
> entries.
>
> Pal, what hardware is that specifically?

This is a Bubba | Two headless, power pc box.
CPU: 333MHz PowerPC
RAM: 256MB DDR2
Network: 2x Gigabit Ethernet ports, 802.11a/b/g WiFi
Ports: 2x USB2.0, 2x eSATA

See more eg. here:
http://www.linuxuser.co.uk/reviews/bubba-two-wifi-review

Mine Bubba 2 is the older version, that has not the two WiFi antennae on
the back.

I'm trying to set my USB ZyXEL NWD2205 WiFi adapter as an Access Point
here.

> Any idea why it changes the MAC?

I have no idea..

--
Regards from Pal


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/87pp6q4...@gmail.com

Bob Proulx

unread,
Apr 26, 2015, 5:40:03 PM4/26/15
to
csan...@gmail.com wrote:
> Bob Proulx writes:
> > Michael Biebl wrote:
> >> Any idea why it changes the MAC?
> >
> > Hmm... Is 'macchanger' involved in this in any way?
>
> I just installed macchanger and run:

Wait! That was NOT a request to install macchanger. The question was
why is your ethernet address changing? I asked if perhaps you had
already installed macchanger to intentionally change it. If so then
that would explain why your mac address was changing. Now that you
have definitely installed it it is possible that you now have *two*
things changing your ethernet address. As they say, "Now you have two
problems."

This reminds me of: http://en.wikipedia.org/w/index.php?title=World%27s_funniest_joke&oldid=633478023

> macchanger -s wlan0
> Permanent MAC: 00:e0:4c:81:92:dc (Realtek Semiconductor Corp.)
> Current MAC: 00:e0:4c:81:92:dc (Realtek Semiconductor Corp.)

Shows the mac address using the -s option. Okay. No changes made.
This is trivially the same as:

ip addr show wlan0 | grep link

> # macchanger -m 00:e0:4c:81:92:dc wlan0
> Permanent MAC: 00:e0:4c:81:92:dc (Realtek Semiconductor Corp.)
> Current MAC: 00:e0:4c:81:92:dc (Realtek Semiconductor Corp.)
> It's the same MAC!!

This sets the mac address to the value specified using the -m option.
Therefore of course it is the same mac. You have explicitly set the
mac to the same one as before. Did you expect something different?
What?

> So after this what should I do with udev rules in
> 70-persistent-net.rules ?

First you should purge macchanger from your system.

# apt-get purge macchanger

Then get back to your original problem. (Squirrel!) Stay on target.

> Now the line is:
> # USB device 0x:0x (rtl8192cu)
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
> ATTR{address}=="00:e0:4c:81:92:*", ATTR{dev_id}=="0x0", \
> ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"

Other people have been answering this part of your question.

Bob
signature.asc

csan...@gmail.com

unread,
Apr 28, 2015, 12:50:03 AM4/28/15
to
Bob Proulx <b...@proulx.com> writes:

> csan...@gmail.com wrote:
>> Bob Proulx writes:
>> > Michael Biebl wrote:
>> >> Any idea why it changes the MAC?
>> >
>> > Hmm... Is 'macchanger' involved in this in any way?
>>
>> I just installed macchanger and run:
>
> Wait! That was NOT a request to install macchanger. The question was
> why is your ethernet address changing? I asked if perhaps you had
> already installed macchanger to intentionally change it. If so then
> that would explain why your mac address was changing. Now that you
> have definitely installed it it is possible that you now have *two*
> things changing your ethernet address. As they say, "Now you have two
> problems."

Sorry for misunderstanding.

> First you should purge macchanger from your system.
>
> # apt-get purge macchanger

Done; I have no macchanger installed anymore.

> Then get back to your original problem. (Squirrel!) Stay on target.
>
>> Now the line is:
>> # USB device 0x:0x (rtl8192cu)
>> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", \
>> ATTR{address}=="00:e0:4c:81:92:*", ATTR{dev_id}=="0x0", \
>> ATTR{type}=="1", KERNEL=="wlan*", NAME="wlan0"
>
> Other people have been answering this part of your question.

Yes, but I feel I have not a solution for this problem.

--
Regards from Pal


--
To UNSUBSCRIBE, email to debian-us...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listm...@lists.debian.org
Archive: https://lists.debian.org/87mw1su...@gmail.com
0 new messages