Lui*_*uer 22 network-manager networking arm raspberrypi systemd
对于 Ubuntu 16.04 LTS (GNU/Linux 3.10.96-113 armv7l)
当我有以下内容时,我的静态配置将被忽略:
/etc/网络/接口
source-directory /etc/network/interfaces.d
Run Code Online (Sandbox Code Playgroud)
/etc/network/interfaces.d/eth0
auto eth0
iface eth0 inet static
address 192.168.40.112
netmask 255.255.255.0
gateway 192.168.40.1
dns-nameservers 8.8.8.8
Run Code Online (Sandbox Code Playgroud)
但是,以下内容:
/etc/网络/接口
auto eth0
iface eth0 inet static
address 192.168.40.112
netmask 255.255.255.0
gateway 192.168.40.1
dns-nameservers 8.8.8.8
source-directory /etc/network/interfaces.d
Run Code Online (Sandbox Code Playgroud)
静态配置在启动时设置(与我在interfaces.d/ 中的设置无关)。
如果相关,我使用 udev 规则重命名 eth0 接口(它曾经是“enx001e063110c0”...)
Lui*_*uer 35
我想我找到了。从手册来看,问题似乎出在source-directory关键字上。看起来,从 16.04 开始,它不再受支持。
所以更换
source-directory /etc/network/interfaces.d
Run Code Online (Sandbox Code Playgroud)
和
source /etc/network/interfaces.d/*
Run Code Online (Sandbox Code Playgroud)
似乎解决了这个问题。
小智 6
我遇到了大致相同的问题。结果证明source-directory我的系统支持,但只包括文件名由字母、数字、破折号和下划线组成的文件。
这就是为什么我的 eth0.conf 没有被读取的原因,因为它包含一个点。