:: Re: [DNG] Ethernet names revisited
Página Principal
Delete this message
Reply to this message
Autor: tito
Data:  
Para: dng
Assunto: Re: [DNG] Ethernet names revisited
On Sun, 13 Dec 2020 14:25:37 +0100
tito via Dng <dng@???> wrote:

> On Sun, 13 Dec 2020 10:45:56 +0100
> Antony Stone <Antony.Stone@???> wrote:
>
> > On Sunday 13 December 2020 at 09:25:24, terryc wrote:
> >
> > > On Sat, 12 Dec 2020 14:15:53 +0100
> > >
> > > Antony Stone <Antony.Stone@???> wrote:
> > > > Hi.
> > > >
> > > > I've just installed a couple of Beowulf systems, each of which
> > > > has three ethernet interfaces; one on the motherboard, and two
> > > > on a PCI card.
> > > >
> > > > I'm trying to work out how to give those interfaces the names I
> > > > want; the motherboard as eth0, and the PCI card as eth1 / eth2.
> > >
> > > Err, what is not clear in 'man interfaces'
> >
> > If you're referring to the "mapping" section, I've tried that and it
> > doesn't help.
> >
> > > FWIW, I've just had to do a fresh install of Beowulf and as I
> > > always do I manuay define /etc/network/interfaces, e.g.
> > >
> > > # The primary network interface
> > > allow-hotplug eth0
> > > iface eth0 inet static
> > >         address 192.168.x.y
> > >         netmask 255.255.0.0
> > >         gateway 192.168.x.z

> > >
> > > Just add the line
> > >     hwaddress mac:add:dress:in:usual:format

> > >
> > > to match eth2 & eth3 to the desired card.
> >
> > I think that's entirely the wrong way round.
> >
> > Setting hwaddress in /etc/network/interfaces changes the MAC address
> > of the interface according to its name (eth0, eth1, etc).
> >
> > I'm looking for the opposite - I want to make sure that the device
> > whose MAC address is 78:ac:c0:f7:89:f7 gets called "eth0" (instead
> > of "eth2", which is what I get from the kernel), and that the
> > devices with MAC addresses 00:e0:4c:80:21:6b and 00:e0:4c:80:21:6c
> > get called "eth1" and "eth2" respectively, instead of "eth0" and
> > "eth1".
> >
> > I can only repeat - under Jessie and earlier, this was all handled
> > by the settings in /etc/udev/rules.d/70-persistent-net.rules
> >
> > From Ascii onwards I get the errors:
> >
> > udevd[441]: Error changing net interface name eth2 to eth0: File
> > exists udevd[441]: could not rename interface '4' from 'eth2' to
> > 'eth0': File exists
>
> Hi,
> they cannot be renamed because the name is already taken
>
> NIC1 NIC2 NIC3
> eth0 eth1 eth2 (you have)
> eth1 eth0 eth2 (you want)
>
> udevd[441]: Error changing net interface name eth2 to eth0: File
> exists udevd[441]: could not rename interface '4' from 'eth2' to
> 'eth0': File exists
>
> so renaming fails, use predictable names (remove ifnames=0)
>
> NIC1 NIC2 NIC3
> en1p1 en2p1 en3p1 (you have)
> eth1 eth0 eth2 (you want)
>
> as there is no name clash the interfaces can be renamed by
> macaddress with udev rules
>
> SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{address}=="00:11:22:33:44:51", ATTR{type}=="1", KERNEL=="?*",
> NAME:="eth0" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{address}=="00:11:22:33:44:52", ATTR{type}=="1", KERNEL=="?*",
> NAME:="eth1" SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*",
> ATTR{address}=="00:11:22:33:44:53", ATTR{type}=="1", KERNEL=="?*",
> NAME:="eth2" This works for me on my devuan routers and I was bitten
> by what you are experiencing when I thought that adding ifname=0 was
> a good idea. It was not and at the next reboot the interfaces could
> not be reordered to my liking anymore and were assigned in a wrong
> way which locked me out of the router and broke internet for the joy
> of my coworkers.
>
> Ciao,
> Tito


P.S.: to make the renaming happen earlier you can add your persistent
net names file to the initrd in /usr/lib/udev/rules.d/ by hand but
probably this can be made automatic.

> > and so on.
> >
> >
> > Antony.
> >
>
> _______________________________________________
> Dng mailing list
> Dng@???
> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng