Linux 使用可预测的网络接口名称进行直播

Linux 使用可预测的网络接口名称进行直播,linux,networking,debian,Linux,Networking,Debian,我第一次面对网络接口的新名称方案:可预测的网络接口名称 我的问题与这个计划是好是坏无关。。。我只是想知道如何正确地使用它 我读到: 更改接口命名方案时,不要忘记更新所有与网络相关的配置文件和自定义systemd单元文件以反映更改 因此,我必须在所有配置文件中写入实际的接口名称。在之前的方案中,它是,即eth0,它只是指第一个以太网卡,如果有多个接口,则有已知的注意事项 现在,我必须编写可预测的名称,它由一些简单的部分(即接口类型)和其他不可预测的部分(如MAC地址)组成。据我所知,每张卡都有不同

我第一次面对网络接口的新名称方案:可预测的网络接口名称

我的问题与这个计划是好是坏无关。。。我只是想知道如何正确地使用它

我读到:

更改接口命名方案时,不要忘记更新所有与网络相关的配置文件和自定义systemd单元文件以反映更改

因此,我必须在所有配置文件中写入实际的接口名称。在之前的方案中,它是,即
eth0
,它只是指第一个以太网卡,如果有多个接口,则有已知的注意事项

现在,我必须编写可预测的名称,它由一些简单的部分(即接口类型)和其他不可预测的部分(如MAC地址)组成。据我所知,每张卡都有不同的名字

我承认我的问题可能看起来很愚蠢,但我不明白如何准备配置文件。让我们看一个例子,
/etc/dhcpcd.conf

profile static_eth0
static ip_address=192.168.1.23/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1

interface eth0
fallback static_eth0
我应该在o.s.图像中放置什么来代替
eth0
? 只有在运行目标机器时,我才能检索以太网接口的实际名称

我的系统100%都是无头的,我从来没有连接过键盘和显示器。此外,如果我必须发送SBC的备件,我是否需要重新配置所有备件

你能帮我理解正确的用法吗

另外,我知道我可以恢复到旧的命名方案。。。但这不是我问题的重点。

参见 它解释了如何分配名称

Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
Names incorporating the interfaces's MAC address (example: enx78e7d1ea46da)
Classic, unpredictable kernel-native ethX naming (example: eth0)

By default, systemd v197 will now name interfaces following policy 1) if that
information from the firmware is applicable and available, falling back to 2) if
that information from the firmware is applicable and available, falling back to 3)
if applicable, falling back to 5) in all other cases. Policy 4) is not used by 
default, but is available if the user chooses so. 
因此,您可以选择一种不同的方法,可能在您的设置中最容易使用mac,只要在尝试pxe/dhcp请求的映像重新启动并记录发送的mac即可

另一种可能有效的方法是界面分组,具体取决于您的设置

从“人的接口”

因此,如果您只有一个接口,但无法知道它将被分配到哪里,那么您可以编写“auto/e*=eth”来捕获所有以e开头的接口,并在配置文件中将它们命名为“eth”。

请参见 它解释了如何分配名称

Names incorporating Firmware/BIOS provided index numbers for on-board devices (example: eno1)
Names incorporating Firmware/BIOS provided PCI Express hotplug slot index numbers (example: ens1)
Names incorporating physical/geographical location of the connector of the hardware (example: enp2s0)
Names incorporating the interfaces's MAC address (example: enx78e7d1ea46da)
Classic, unpredictable kernel-native ethX naming (example: eth0)

By default, systemd v197 will now name interfaces following policy 1) if that
information from the firmware is applicable and available, falling back to 2) if
that information from the firmware is applicable and available, falling back to 3)
if applicable, falling back to 5) in all other cases. Policy 4) is not used by 
default, but is available if the user chooses so. 
因此,您可以选择一种不同的方法,可能在您的设置中最容易使用mac,只要在尝试pxe/dhcp请求的映像重新启动并记录发送的mac即可

另一种可能有效的方法是界面分组,具体取决于您的设置

从“人的接口”

因此,如果您只有一个接口,但无法知道它将被分配到哪里,那么您可以编写“auto/e*=eth”来捕获所有以e开头的接口,并在配置文件中将它们命名为“eth”