nmcli con mod myEth autoconnect no # 设置myEth连接配置为不自动连接(重启操作系统或从起NetworkManager就能看到不会自动连接了)
device对象(网络接口)
用途
显示或管理网络接口
语法
nmcli device { status | show | set | connect | reapply | modify | disconnect | delete | monitor | wifi | lldp } [ARGUMENTS...]
子命令详细解释(这里不全部翻译,理解了上面connection,这里也是差不多的): set [ifname] ifname [ autoconnect { yes | no } ] [ managed { yes | no } ]
Set device properties. connect ifname Connect the device. NetworkManager will try to find a suitable connection that will be activated. It will also consider connections that are not set to auto connect.If no compatible connection exists, a new profile with default settings will be created and activated. This differentiates nmcli connection up ifname "DEVICE" If --wait option is not specified, the default timeout will be 90 seconds.
reapply ifname
Attempt to update device with changes to the currently active connection made since it was last applied.
modify ifname { option value | [+|-]setting.property value } ...
Modify the settings currently active on the device.
This command lets you do temporary changes to a configuration active on a particular device. The changes are not preserved in the connection profile.See nm-settings(5) for the list of available properties. Please note that some properties can't be changed on an already connected device.You can also use the aliases described in Property Aliases section. The syntax is the same as of the nmcli connection modify command.
disconnect ifname...
Disconnect a device and prevent the device from automatically activating further connections without user/manual intervention. Note that disconnecting software devices may mean that the devices will disappear.(这段翻译一下:断开设备连接,并防止设备自动激活。 断开软设备的连接可能会让这些设备消失)
If --wait option is not specified, the default timeout will be 10 seconds.
delete ifname...
Delete a device. The command removes the interface from the system. Note that this only works for software devices like bonds, bridges, teams, etc(仅能删除软设备,例如bond、桥等). Hardware devices (like Ethernet) cannot be deleted by the command.(硬设备无法删除)
wifi [ list [--rescan | auto | no | yes ] [ifname ifname] [bssid BSSID] ]
列出wifi热点,可以指定无线网卡接口名和热点BSSID。列出的热点列表不会超过30秒,必要时会重新扫描(通过--rescan控制重新扫描:取值auto yes no)
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】凌霞软件回馈社区,博客园 & 1Panel & Halo 联合会员上线
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】博客园社区专享云产品让利特惠,阿里云新客6.5折上折
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步