:: Re: [DNG] if2mac init.d service for…
トップ ページ
このメッセージを削除
このメッセージに返信
著者: tito
日付:  
To: dng
題目: Re: [DNG] if2mac init.d service for persistent network interface names
On Fri, 18 Dec 2020 15:22:37 +0100
Didier Kryn <kryn@???> wrote:

> Le 18/12/2020 à 14:41, tito via Dng a écrit :
> > On Fri, 18 Dec 2020 10:36:01 +0100
> > Didier Kryn <kryn@???> wrote:
> >
> >> Le 18/12/2020 à 00:17, tito via Dng a écrit :
> >>> Hi,
> >>> a few days ago I was able to complete may new router
> >>> with 12 nics and 1 wifi. I moved the devuan drive from
> >>> my previous defunct box to the new one and experienced
> >>> all the problems reported in the "Ethernet names revisited"
> >>> thread.
> >>> I tried all the wise advice of the thread included my own
> >>> just to discover that nothing really works reliably.
> >>>
> >>> Things I've tried in various combinations:
> >>>
> >>> 1) 70-persistent-net.rules with mac
> >>> 2) 70-persistent-net.rules with pci bus numbers
> >>> 3) 60-persistent-net.rules with mac
> >>> 4) 60-persistent-net.rules with pci bus numbers
> >>> 5) net.ifnames=0 / net.ifnames=1 in grub
> >>> 6) biosdevname=0 in grub
> >>> 7) renaming the interfaces in /etc/network/interfaces
> >>> 8) using ifrename
> >>>
> >>> Always the 12 nics came up with different names,
> >>> or some of them were missing due to collisions
> >>> during the rename process and the router was
> >>> borked with me yelling.
> >>> Especially sarcastic I've found the definition of
> >>> the new "predictable names" because there is
> >>> nothing really predictable about them and at every
> >>> reboot they can be totally different, one time being
> >>> enp5s0 and next time enp8s0f1 depending on
> >>> the BIOS initialization process ( I suppose....).
> >>> At the end I started thinking about a KISS way to get
> >>> my persistent interface names back without
> >>> using udev/eudev or other non cooperative software.
> >>> I've come up with a init script that I've called
> >>> if2mac that matches interfaces to mac addresses
> >>> early in the boot process before networking is set up,
> >>> that for me works reliably (after a night of reboots).
> >>> I post it here so that If some bold beta testers on the list
> >>> are interested they can try it out in the hope that
> >>> it works for them (and AT THEIR OWN RISK!!!).
> >>> To use it copy the script to /etc/init.d/:
> >>>
> >>> cp if2mac /etc/init.d/
> >>> chmod +x /etc/init.d/if2mac
> >>> insserv if2mac
> >>>
> >>> and the configuration file to /etc/if2mac.conf.
> >>>
> >>> ## Sample configuration file for if2mac.
> >>> ##
> >>> ## WIRED_MAC_LIST and WIRELESS_MAC_LIST contain a list of MAC
> >>> ## addresses in the desired order top to down starting at
> >>> ## position 0. For example:
> >>> ## WIRED_MAC_LIST="\
> >>> ## 00:11:22:33:44:54 \ <= The space is needed!!!
> >>> ## 00:11:22:33:44:55 \
> >>> ## 00:11:22:33:44:56"
> >>> ## The WIRED_PREFIX and WIRELESS_PREFIX variables can be changed
> >>> ## at your liking (opt, port, whatever).
> >>>
> >>> WIRED_PREFIX="eth"
> >>>
> >>> WIRED_MAC_LIST="\
> >>> 00:12:21:c4:56:68 \
> >>> 00:12:21:c4:56:69 \
> >>> 00:13:21:c4:56:6a \
> >>> 00:13:21:c4:56:6b \
> >>> 00:33:18:04:a3:46 \
> >>> 00:34:18:04:a3:47 \
> >>> 00:35:18:04:a3:48 \
> >>> 00:36:18:04:a3:49 \
> >>> 00:36:18:04:a3:4a \
> >>> 00:36:18:04:a3:4b \
> >>> 00:36:18:04:a3:4c \
> >>> 00:56:18:04:a3:4d"
> >>>
> >>> WIRELESS_PREFIX="wlan"
> >>>
> >>> WIRELESS_MAC_LIST="\
> >>> 54:2a:a2:2b:b3:55"
> >>>
> >>> Attached you will find the init script and a sample
> >>> configuration file. Multiple configuration files
> >>> to allow more prefixes are not supported because
> >>> this kind of renaming could be done in /etc/network/interfaces
> >>> once the interfaces came up with predictable and persistent
> >>> names. At this time only
> >>>
> >>> en      Ethernet wired
> >>> et     Ethernet wired old
> >>> wl     Wireless local area network (WLAN)

> >>>
> >>> interfaces are supported with both old style
> >>> and new "predictable" names.
> >>>
> >>> Prerequisites are:
> >>> /bin/cat
> >>> /sbin/ip
> >>> and a mounted /sysfs.
> >>>
> >>> Hints improvements and critics are welcome.
> >>> Eventually if there is some interest this could be packaged
> >>> (with the help of some devuan packaging gurus).
> >>>
> >>> Hope this helps. Enjoy.
> >>> Ciao,
> >>> farmatito
> >>     Looks like the cleanest thing to do to workaround
> >> non-cooperative software, as you write. I'ts a pitty to be forced
> >> to that, but, at first read it looks well done. I didn't try it
> >> because nowadays I only use computers with ar most one eth and one
> >> wifi. Just found typos in a comment:
> >>
> >> # We need to passes to allow interface swappin
> >>
> >> should be
> >>
> >> # We need two passes to allow interface swapping
> >>
> >> Well done.
> >>
> >> --         Didier
> >>
> > Hi,
> > Thanks, typo fixed.
> >
>     Shouldn't we consider using Mdev instead of Eudev? You, as a
> distinguished contributor to Busybox, should have an opinion on this.
>
> --         Didier
>

Hi,
to be honest I have no opinion on it because I never looked at the code
(last time I touched something similar it was devfsd which I shrinked
in a ugly way for bb) and it would be a cold dive anyway.
Does mdev have all needed features to replace udev/eudev?
I'm for sticking as close as possible to debian (until they are
enlightened....centos' end should be a lesson to them) to reduce the
fallout of the changes and because the devuan manpower is limited.
Minor non invasive modifications like if2mac script give you back the
desired functionality without interfering with the internals.

Ciao,
Tito