:: Re: [DNG] Ethernet names revisited
Page principale
Supprimer ce message
Répondre à ce message
Auteur: dng@d404.nl
Date:  
À: dng
Sujet: Re: [DNG] Ethernet names revisited
On 13-12-2020 14:20, Antony Stone wrote:
> On Sunday 13 December 2020 at 13:02:45, Florian Zieboll via Dng wrote:
>
>> Am 13. Dezember 2020 12:01:39 MEZ schrieb Antony Stone
> <Antony.Stone@???>:
>>> Well, here's the output from "dmesg | grep eth". It shows the r8169
>>> interfaces being given names eth0, eth1 (the ones I want as eth1 and
>>> eth2), then the tg3 interface gets called eth2 (which I want as eth0).
>>>
>>> At 6 seconds in, you can see my 70-persistent-net.rules file kicking in
>>> and renaming then to xeth2, xeth1 and xeth0; then finally at 12 seconds,
>>> the second rename in /etc/network/interfaces sets them back to eth0,
>>> eth1 and eth2 in the order I want them.
>> So have you tried with 'ifnames=1'?
> I hadn't, but I've just done so now - it makes no difference - here's dmesg:
>
> [    0.000000] Linux version 4.19.0-10-amd64 (debian-kernel@???) 
> (gcc version 8.3.0 (Debian 8.3.0-6)) #1 SMP Debian 4.19.132-1 (2020-07-24)
> [    0.000000] Command line: BOOT_IMAGE=/boot/vmlinuz-4.19.0-10-amd64 
> root=UUID=9cbc8bd3-4cb8-4ae1-92c5-5a3659e9aed6 ro net.ifnames=1 quiet

>
> [    3.394364] r8169 0000:04:00.0 eth0: RTL8168e/8111e, 00:e0:4c:80:21:6b, XID 
> 2c200000, IRQ 30
> [    3.394368] r8169 0000:04:00.0 eth0: jumbo features [frames: 9200 bytes, tx 
> checksumming: ko]
> [    3.450174] r8169 0000:05:00.0 eth1: RTL8168e/8111e, 00:e0:4c:80:21:6c, XID 
> 2c200000, IRQ 31
> [    3.450177] r8169 0000:05:00.0 eth1: jumbo features [frames: 9200 bytes, tx 
> checksumming: ko]
> [    3.489342] tg3 0000:07:00.0 eth2: Tigon3 [partno(BCM95723) rev 5784100] 
> (PCI Express) MAC address 78:ac:c0:f7:89:f7
> [    3.489347] tg3 0000:07:00.0 eth2: attached PHY is 5784 (10/100/1000Base-T 
> Ethernet) (WireSpeed[1], EEE[0])
> [    3.489350] tg3 0000:07:00.0 eth2: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[0] 
> TSOcap[1]
> [    3.489352] tg3 0000:07:00.0 eth2: dma_rwctrl[76180000] dma_mask[64-bit]
> [    6.187233] tg3 0000:07:00.0 xeth0: renamed from eth2
> [    6.231916] r8169 0000:05:00.0 xeth2: renamed from eth1
> [    6.246745] r8169 0000:04:00.0 xeth1: renamed from eth0

>
>> And are you sure, that the 'hwaddress' lines in your
>> '/etc/network/interfaces' really define which NIC to use?
> I'm not using hwaddress in that file - that was a suggestion from terryc, and I
> think it's the wrong idea for exactly the following reason:
>
>> AFAICT this option just changes ("spoofs") the MAC address of the NIC for
>> which it is defined. Although the log confirms that finally eth0 is the tg3
>> NIC, this seems unusual (and very counterintuitive) to me.
>
> Thanks,
>
>
> Antony.
>

It looks like systemd again is responsible for this mess. From what I
understand uses eudev the same files as systemd with udev. If so you
should do

ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules

to make sure (e)udev does not mess with the network devices. (/etc/udev
seems to have priority above /lib/udev)

After that it is somewhat unclear to me. Or
/etc/udev/rules.d/70-persistent-net.rules should work again. Or you
should add a 70-net-name-slot.rules with the syntax of
80-net-name-slot.rules like

SUBSYSTEM!="net", GOTO="net_setup_link_end"
IMPORT{builtin}="path_id"
ACTION!="add", GOTO="net_setup_link_end"
IMPORT{builtin}="net_setup_link"

NAME=="eth0", ENV{ID_NET_NAME_ONBOARD}!="", NAME="$env{ID_NET_NAME_ONBOARD}"
NAME=="eth0", ENV{ID_NET_NAME_SLOT}!="", NAME="$env{ID_NET_NAME_SLOT}"
NAME=="eth0", ENV{ID_NET_NAME_PATH}!="", NAME="$env{ID_NET_NAME_PATH}"

LABEL="net_setup_link_end"


After adding net.ifnames=0 and biosdevname=0 your system should work as
intended but I do not have the time to test it, hopes it helps in the
right direction.

Grtz.

Nick