前提:
系统使用 NetworkManager 来管理网络接口。
步骤:
1.使用以下命令显示网络连接列表:
nmcli connection show
输出结果示例:
NAME UUID TYPE DEVICE Example 7a7e0151-9c18-4e6f-89ee-65bb2d64d365 ethernet enp1s0 ...
2.将连接的 ipv6.method 或 ipv4.method 参数设为 disabled :
nmcli connection modify Example ipv6.method "disabled"
或
nmcli connection modify Example ipv4.method "disabled"
重启网络连接:
nmcli connection up Example
验证:
显示设备的 IP 设置:
ip address show enp1s0
信息中没有IPV6或IPV4地址,则说明其被禁用。
参考地址: