要在 Ubuntu 中使用 ifconfig 禁用网络接口,请按照以下步骤操作:
打开终端(快捷键:Ctrl + Alt + T)。
首先,通过运行以下命令查看所有可用的网络接口:
ifconfig -a
找到你想要禁用的网络接口名称。它可能类似于 “eth0” 或 “wlan0”。
要禁用网络接口,请运行以下命令,将 “interface_name” 替换为你在上一步找到的网络接口名称:
sudo ifconfig interface_name down
例如,如果你想要禁用名为 “eth0” 的网络接口,你应该输入:
sudo ifconfig eth0 down
现在,该网络接口已被禁用。 若要重新启用它,只需将 “down” 替换为 “up”,如下所示:
sudo ifconfig eth0 up