【问题标题】:Live with Predictable Network Interface Name使用可预测的网络接口名称
【发布时间】:2018-01-31 23:25:35
【问题描述】:

我第一次面对网络接口的新命名方案:Predictable Network Interface Name。

我的问题与这个方案是好是坏无关......我只是想了解如何正确使用它。

Here我看了:

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

所以我必须在所有配置文件中写入实际的接口名称。在之前的方案中,它是 eth0,它仅表示第一块以太网卡,如果有多个接口,则需要注意。

现在,相反,我必须编写 predictable 名称,它由一些简单的部分(即接口类型)和其他 un-predictable 部分组成,例如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

我应该在操作系统中添加什么而不是 eth0图片? 只有当我运行目标机器时,我才能检索以太网接口的实际名称。

我的系统 100% 是无头的,我从不将键盘和显示器连接到它们。此外,如果我必须发送 SBC 的备件,是否需要全部重新配置?

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

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

【问题讨论】:

    标签: linux networking debian


    【解决方案1】:

    https://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/ 它解释了如何分配名称

    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 /eth*
    
       If the kernel knows about the interfaces with names lo, eth0 and eth1, then the above line is then interpreted as:
    
       auto eth0 eth1
    
       Note that there must still be valid "iface" stanzas for each matching interface.  However, it is possible to combine a pattern with a mapping to a logical interface, like so:
    
       auto /eth*=eth
       iface eth inet dhcp
    

    所以如果你只有一个接口,但不知道它会被分配到哪里,你可以写“auto /e*=eth”来捕获所有以e开头的接口,并在配置文件中将它们寻址为“ eth”。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-15
      • 1970-01-01
      • 1970-01-01
      • 2011-10-24
      • 1970-01-01
      • 1970-01-01
      • 2012-09-10
      • 1970-01-01
      相关资源
      最近更新 更多