All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* how to change mac address using udev
@ 2011-10-11 23:07 Sasha Alko
  2011-10-18  9:49 ` Sasha Alko
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Sasha Alko @ 2011-10-11 23:07 UTC (permalink / raw
  To: linux-hotplug

Hi,

I am trying to change mac address in this way:

subsystem="usb", action="add", attrs{idvendor},
attr{address}="00:11:22:33:44:55"

But this generates the error "error opening
ATTR{/sys/deivces/.../net/eth1/address} for writing: Permission denied

I know that NetworkManager is able to change mac address and I guess
NM uses udev to change mac.

Could you please advice me how to change mac using udev.

Kind regards,
S

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how to change mac address using udev
  2011-10-11 23:07 how to change mac address using udev Sasha Alko
@ 2011-10-18  9:49 ` Sasha Alko
  2011-10-18 10:59 ` Kay Sievers
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Sasha Alko @ 2011-10-18  9:49 UTC (permalink / raw
  To: linux-hotplug

Hi,

Does anybody have an example how to change MAC address using udev?

Kind regards,
S

2011/10/12 Sasha Alko <alkosasha@gmail.com>:
> Hi,
>
> I am trying to change mac address in this way:
>
> subsystem="usb", action="add", attrs{idvendor},
> attr{address}="00:11:22:33:44:55"
>
> But this generates the error "error opening
> ATTR{/sys/deivces/.../net/eth1/address} for writing: Permission denied
>
> I know that NetworkManager is able to change mac address and I guess
> NM uses udev to change mac.
>
> Could you please advice me how to change mac using udev.
>
> Kind regards,
> S
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how to change mac address using udev
  2011-10-11 23:07 how to change mac address using udev Sasha Alko
  2011-10-18  9:49 ` Sasha Alko
@ 2011-10-18 10:59 ` Kay Sievers
  2011-10-18 14:46 ` Sasha Alko
  2011-10-18 16:06 ` Kay Sievers
  3 siblings, 0 replies; 5+ messages in thread
From: Kay Sievers @ 2011-10-18 10:59 UTC (permalink / raw
  To: linux-hotplug

On Tue, Oct 18, 2011 at 11:49, Sasha Alko <alkosasha@gmail.com> wrote:
> Does anybody have an example how to change MAC address using udev?

You can probably set it temporarily with the /sbin/ip tool.

Usually, MAC addresses are part of the hardware, burned into the ROM
of your network card. Udev itself has absolutely no idea about
specific hardware settings.

Kay

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how to change mac address using udev
  2011-10-11 23:07 how to change mac address using udev Sasha Alko
  2011-10-18  9:49 ` Sasha Alko
  2011-10-18 10:59 ` Kay Sievers
@ 2011-10-18 14:46 ` Sasha Alko
  2011-10-18 16:06 ` Kay Sievers
  3 siblings, 0 replies; 5+ messages in thread
From: Sasha Alko @ 2011-10-18 14:46 UTC (permalink / raw
  To: linux-hotplug

Yes I can change MAC manually using ifconfig or other tools. But I
would like to change MAC automatically when network device is
attaching. The problem is that I have two RNDIS device which utilize
the same MAC address. The NetworkManager in Ubuntu is able to change
MAC automatically based on original MAC. But it is not the case
because I need to make some checks, e.g. change mac only if first card
is already attached and do not make anything if no card with RNDIS
driver is attached.

Udev is operate with MAC address through ATTRS{address} but I didn't
find how to rewrite this attribute:

error opening ATTR{/sys/devices/.../net/eth1/address} for writing:
Permission denied

It seems to me NetworkManager uses libudev to operate with mac, but I
can't realize how to operate with mac using udev rules.

BR,
Sasha

2011/10/18 Kay Sievers <kay.sievers@vrfy.org>:
> On Tue, Oct 18, 2011 at 11:49, Sasha Alko <alkosasha@gmail.com> wrote:
>> Does anybody have an example how to change MAC address using udev?
>
> You can probably set it temporarily with the /sbin/ip tool.
>
> Usually, MAC addresses are part of the hardware, burned into the ROM
> of your network card. Udev itself has absolutely no idea about
> specific hardware settings.
>
> Kay
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: how to change mac address using udev
  2011-10-11 23:07 how to change mac address using udev Sasha Alko
                   ` (2 preceding siblings ...)
  2011-10-18 14:46 ` Sasha Alko
@ 2011-10-18 16:06 ` Kay Sievers
  3 siblings, 0 replies; 5+ messages in thread
From: Kay Sievers @ 2011-10-18 16:06 UTC (permalink / raw
  To: linux-hotplug

On Tue, Oct 18, 2011 at 16:46, Sasha Alko <alkosasha@gmail.com> wrote:
> Yes I can change MAC manually using ifconfig or other tools. But I
> would like to change MAC automatically when network device is
> attaching. The problem is that I have two RNDIS device which utilize
> the same MAC address. The NetworkManager in Ubuntu is able to change
> MAC automatically based on original MAC. But it is not the case
> because I need to make some checks, e.g. change mac only if first card
> is already attached and do not make anything if no card with RNDIS
> driver is attached.
>
> Udev is operate with MAC address through ATTRS{address} but I didn't
> find how to rewrite this attribute:

Most attributes are not writable. But that doesn't mean the underlying
stuff can't be changed with other interfaces. If calling /sbin/ip ....
works, just call it from udev.

> It seems to me NetworkManager uses libudev to operate with mac, but I
> can't realize how to operate with mac using udev rules.

No, udev is not involved in any specifics of network device setups, or
any other device classes. It can just gather data, create symlinks,
adjust permissions or rename network device names, and call tools it
is asked for to run.

Kay

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-18 16:06 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-11 23:07 how to change mac address using udev Sasha Alko
2011-10-18  9:49 ` Sasha Alko
2011-10-18 10:59 ` Kay Sievers
2011-10-18 14:46 ` Sasha Alko
2011-10-18 16:06 ` Kay Sievers

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.