重启后 ifconfig 更改未保存

6 linux ubuntu ifconfig

我更改了网络设备名称,但重新启动后它们没有保存。我还停用了 wlan0 接口,但重新启动后它仍然打开。使用 UBUNTU。

这里/etc/network/interfaces

# interfaces(5) file used by ifup(8) and ifdown(8)
# Include files from /etc/network/interfaces.d:
source-directory /etc/network/interfaces.d

# The loopback network interface
auto lo
iface lo inet loopback


# The wan0 network interface
auto wan0
iface wan0 inet dhcp

# The eth0 network interface
auto eth0
iface eth0 inet dhcp
Run Code Online (Sandbox Code Playgroud)

小智 3

如果您用于ifconfig配置网络接口,则更改将在重新启动后丢失。

为了使更改持久,您需要修改配置文件,例如/etc/network/interfaces. 例如,要禁用某个接口,您只需从文件中删除其配置部分即可。

您可以检查man interfacesUbuntu 的可用选项和网络配置文件格式。