我在具有环回和 eth0 网络接口的目标上创建了 Yocto 映像。
当我使用静态 IP 配置 /etc/network/interface 时,network down 命令起作用。命令 ifdown -a 之后 ifconfig 不返回任何内容。
我的 /etc/network/interface 处于静态模式:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# Main wired interface
auto eth0
iface eth0 inet static
address 192.168.1.10
netmask 255.255.255.0
gateway 192.168.1.1
dns-nameservers 192.168.1.1
Run Code Online (Sandbox Code Playgroud)
如果我将 eth0 配置为 DHCP 模式,就会出现问题:
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# The loopback interface
auto lo
iface lo inet loopback
# …
Run Code Online (Sandbox Code Playgroud)