On 1/31/20 2:05 AM, ghe wrote:
On Jan 30, 2020, at 04:48 PM, Bob Weber <bobrwe...@gmail.com> wrote:
"Example 3. Debugging NamePolicy= assignments" near the bottom of the page at
"https://www.freedesktop.org/software/systemd/man/systemd.link.html"
Yeah. That's one I looked at. The one with the table of the Ethernet speeds and
duplexity. And the list and descriptions of data that're sometimes needed in
the file.
I'll look at this again tomorrow, Bob, but I'm really not impressed with the way systemd
is setting up the Ethernet interfaces. Like I said before, "Counting Ethernet
interfaces isn't rocket science." But it can be made so if you make things complex
and spread the config over several dirs and several files, some of which are explained in
the dox but turn out not to exist on my Buster disk.
Somehow, back in the eth days, the data in Debian's /etc/network/interfaces
file was enough to get networking going. Then, on an Ethernet network, the
Ethernet chips pretty well figured out the best speed and duplex all by
themselves as soon as they connected to something.
This nameing configuration has worked on 5 Debian systems all running updated
testing.
And counting interfaces has worked for me for a couple decades, on many systems
and several OSs. But I'll find your earlier email and try systemd one more
time. It'd be nice for the interface names to be, as systemd calls it,
'consistent.'
And, FWIF, I appreciate your help and advice...
I just ran a test on a VM that I installed last week so it is pretty much up to
date. I ran the command "ip a" which gave me the current undesirable name
"enp1s0" and MAC address.
First I created /etc/systemd/network/10-eth0.link using the MAC address and the
name eth0. If the MAC changes then there are other characteristics to add to
the [Match] section to uniquely define the port (see above link).
-------
root@debian-ZFS ~ # cat /etc/systemd/network/10-eth0.link
[Match]
MACAddress=52:54:00:ea:e3:53
[Link]
Name=eth0
Second I linked the default to /dev/null.
-----
link -s /dev/null /etc/systemd/network/99-Default.link
Next I ran the test command from Example 3 at the above link to see what udevadm
thinks.
-----
SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link
/sys/class/net/enp1s0
Trying to open "/etc/systemd/hwdb/hwdb.bin"...
Trying to open "/etc/udev/hwdb.bin"...
Trying to open "/usr/lib/systemd/hwdb/hwdb.bin"...
Trying to open "/lib/systemd/hwdb/hwdb.bin"...
Trying to open "/lib/udev/hwdb.bin"...
=== trie on-disk ===
tool version: 244
file size: 10287564 bytes
header size 80 bytes
strings 2145012 bytes
nodes 8142472 bytes
Load module index
Found container virtualization none.
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Skipping empty file: /etc/systemd/network/99-Default.link
Parsed configuration file /usr/lib/systemd/network/73-usb-net-by-mac.link
Parsed configuration file /etc/systemd/network/10-eth0.link
Created link configuration context.
ID_NET_DRIVER=virtio_net
enp1s0: Config file /etc/systemd/network/10-eth0.link is applied
ethtool: autonegotiation is unset or enabled, the speed and duplex are not
writable.
enp1s0: Device has name_assign_type=4
Using default interface naming scheme 'v243'.
enp1s0: Policies didn't yield a name, using specified Name=eth0.
ID_NET_LINK_FILE=/etc/systemd/network/10-eth0.link
ID_NET_NAME=eth0
Unload module index
Unloaded link configuration context.
Notice the ID_NET_NAME=eth0 is what I wanted. Also option to the udevadm
command /sys/class/net/enp1s0 contains the current undesirable name of the
interface (enp1s0).
Now I rebooted the VM. I ran the "ip a" command again.
-----
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP
group default qlen 1000
link/ether 52:54:00:ea:e3:53 brd ff:ff:ff:ff:ff:ff
inet 192.168.240.228/24 brd 192.168.240.255 scope global dynamic
noprefixroute eth0
valid_lft 3550sec preferred_lft 3550sec
inet6 fe80::5054:ff:feea:e353/64 scope link noprefixroute
valid_lft forever preferred_lft forever
Just what I wanted.
Now running the udevadm command from before with the old name fails:
SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link
/sys/class/net/enp1s0
Trying to open "/etc/systemd/hwdb/hwdb.bin"...
Trying to open "/etc/udev/hwdb.bin"...
Trying to open "/usr/lib/systemd/hwdb/hwdb.bin"...
Trying to open "/lib/systemd/hwdb/hwdb.bin"...
Trying to open "/lib/udev/hwdb.bin"...
=== trie on-disk ===
tool version: 244
file size: 10287564 bytes
header size 80 bytes
strings 2145012 bytes
nodes 8142472 bytes
Load module index
Found container virtualization none.
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Skipping empty file: /etc/systemd/network/99-Default.link
Parsed configuration file /usr/lib/systemd/network/73-usb-net-by-mac.link
Parsed configuration file /etc/systemd/network/10-eth0.link
Created link configuration context.
Failed to open device '/sys/class/net/enp1s0': No such device
Unload module index
Unloaded link configuration context.
But with the new name eth0 all is well.
SYSTEMD_LOG_LEVEL=debug udevadm test-builtin net_setup_link /sys/class/net/eth0
Trying to open "/etc/systemd/hwdb/hwdb.bin"...
Trying to open "/etc/udev/hwdb.bin"...
Trying to open "/usr/lib/systemd/hwdb/hwdb.bin"...
Trying to open "/lib/systemd/hwdb/hwdb.bin"...
Trying to open "/lib/udev/hwdb.bin"...
=== trie on-disk ===
tool version: 244
file size: 10287564 bytes
header size 80 bytes
strings 2145012 bytes
nodes 8142472 bytes
Load module index
Found container virtualization none.
timestamp of '/etc/systemd/network' changed
Parsed configuration file /usr/lib/systemd/network/99-default.link
Skipping empty file: /etc/systemd/network/99-Default.link
Parsed configuration file /usr/lib/systemd/network/73-usb-net-by-mac.link
Parsed configuration file /etc/systemd/network/10-eth0.link
Created link configuration context.
ID_NET_DRIVER=virtio_net
eth0: Config file /etc/systemd/network/10-eth0.link is applied
ethtool: autonegotiation is unset or enabled, the speed and duplex are not
writable.
eth0: Device has name_assign_type=4
Using default interface naming scheme 'v243'.
eth0: Policies didn't yield a name, using specified Name=eth0.
ID_NET_LINK_FILE=/etc/systemd/network/10-eth0.link
ID_NET_NAME=eth0
Unload module index
Unloaded link configuration context.
*...Bob*