From: Kay Sievers on
On Fri, Jul 9, 2010 at 09:18, Florian Weimer <fweimer(a)bfk.de> wrote:
>> Ok, but can we achieve the renaming w/o a reboot?
>
> "udev-trigger" or "udevadm trigger" works for renaming network
> interfaces.  The kernel has some restrictions on renaming interfaces
> which are in use, so this might not work in your case.

On older systems it would be:
udevtrigger
on newer systems it would be:
udevadm trigger

On recent systems you need to add:
udevadm trigger --action=add
otherwise 'change' events will be triggered, which don't rename any
netif. The default 'add' events caused too many problems with tools
with not well integrated tools.

And you should always limit the trigger to the subsystem you want to work with:
udevadm trigger --action=add --subsystem-match=net
otherwise you run events for all devices on the system, which may
cause completely unrelated trouble.

Anyway, it's not recommended to do anything like this. On many distros
it will cause trouble with the network scripts/services, which are run
again for already active interfaces. Using the udevadm trigger
'hammer' on the running system may lead to all sorts of problems. This
tool is usually only used at coldplug time during bootup.

Also, busy interfaces which might be included in the rename attempt
will cause ethX_rename failures if names need to be swapped.

In general, there is no safe way, or a tool to do this. You have to
know very well what you are doing. It's pretty common, that you
disconnect yourself from a remote box if you try anything like this.

Kay
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Florian Weimer on
* Kay Sievers:

> Anyway, it's not recommended to do anything like this. On many distros
> it will cause trouble with the network scripts/services, which are run
> again for already active interfaces. Using the udevadm trigger
> 'hammer' on the running system may lead to all sorts of problems. This
> tool is usually only used at coldplug time during bootup.

There was a time when the Debian scripts were pretty robust. But
maybe we've just been lucky.

> In general, there is no safe way, or a tool to do this. You have to
> know very well what you are doing. It's pretty common, that you
> disconnect yourself from a remote box if you try anything like this.

Yeah, but there should be a way to do this over OOB management,
without requiring a reboot. 8-(

--
Florian Weimer <fweimer(a)bfk.de>
BFK edv-consulting GmbH http://www.bfk.de/
Kriegsstra�e 100 tel: +49-721-96201-1
D-76133 Karlsruhe fax: +49-721-96201-99
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Loke, Chetan on
> -----Original Message-----
> From: Florian Weimer [mailto:fweimer(a)bfk.de]
> Sent: July 09, 2010 3:18 AM
> To: Loke, Chetan
> Cc: Matt Domsch; Michael Di Domenico; linux-net(a)vger.kernel.org;
linux-
> kernel(a)vger.kernel.org
> Subject: Re: nic enumeration
>
> * Chetan Loke:
>
> >> And on a system where you can use udev rules, the
> >> 70-persistent-net.rules file can be used to make them constant, by
> >> using the MAC address to force the names to be what you want.
> >>
> >
> > Ok, but can we achieve the renaming w/o a reboot?
>
> "udev-trigger" or "udevadm trigger" works for renaming network
> interfaces. The kernel has some restrictions on renaming interfaces
> which are in use, so this might not work in your case.
>
> --

Ok, no renaming, I would like a reference. And symlink just doesn't work
w/ the udevadm trigger business. We've tried that already.

What needs to be changed in udev etc to create a soft link? Any place
where I should start digging and gotchas to lookout for?



> Florian Weimer <fweimer(a)bfk.de>

Chetan Loke
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Matt Domsch on
On Fri, Jul 09, 2010 at 12:27:53PM -0400, Loke, Chetan wrote:
> Ok, no renaming, I would like a reference. And symlink just doesn't work
> w/ the udevadm trigger business. We've tried that already.
>
> What needs to be changed in udev etc to create a soft link? Any place
> where I should start digging and gotchas to lookout for?

Unlike disks which have /dev/disk/by-{id,path,uuid}/* symlinks back to
/dev/sd*, which udev manages, network devices have no such on-disk
representation for udev to manage. My proposal to create such on-disk
mappings was shot down, as was my suggestion to create (multiple)
network device symlinks/references/aliases inside the kernel.

The approach I'm pursuing now is called libnetdevname[1], which can
take as input a device name from various name spaces (BIOS-provided
from SMBIOS or in future, ACPI, or perhaps a userspace mapping similar
to /etc/mactab in concept), and which as output is the single kernel
name for a device. Once plumbed into the tools that manipulate
network devices, it would allow you to do:
# ip addr add xx.xx.xx.xx dev Embedded_NIC_1
and have "Embedded_NIC_1" map to the appropriate "ethN", for use by
the calls into the kernel.

In this case, Embedded_NIC_1 would come from BIOS; conceivably other
namespace sources could hook into this same framework then.

FWIW, I have a talk at LinuxCon Boston coming up on this, and have a
proposal in for Linux Plumbers Conference as well.

Thanks,
Matt

[1] http://linux.dell.com/wiki/index.php/Oss/libnetdevname

--
Matt Domsch
Technology Strategist
Dell | Office of the CTO
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
From: Steve Fink on
On Fri, Jul 9, 2010 at 9:27 AM, Loke, Chetan <Chetan.Loke(a)netscout.com> wrote:
> Ok, no renaming, I would like a reference. And symlink just doesn't work
> w/ the udevadm trigger business. We've tried that already.
>
> What needs to be changed in udev etc to create a soft link? Any place
> where I should start digging and gotchas to lookout for?

By "soft link", I assume you're talking figuratively? Soft (symbolic)
links are a filesystem concept, implemented by filesystem-specific
logic that knows how to read a filename out of an inode and restart
lookup. In order for something similar to work for network devices,
somebody would have had to explicitly implement similar functionality.
(Symlinks are a big headache and source of security holes -- access
control, loops, pointing to nonexistent files, etc. -- so there's a
good reason to NOT have an equivalent for network devices.)

But perhaps there *is* an equivalent: what about (ab)using bridges?
Create a set of bridges and bind each one to a single NIC. You can
name the bridges whatever you want, and set up the mapping through
arbitrary logic.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/