这个问题之前曾被问过https://unix.stackexchange.com/questions/114364/nmcli-no-longer-allow-settings-modification- 但从未得到答复。所以我会尝试在这里提问:
你可以从网上的各种帖子中看到,命令行网络管理器曾经支持类似的东西(来自https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Networking_Guide/sec-Using_the_NetworkManager_Command_Line_Tool_nmcli.html):
$ nmcli connection show id 'MyCafe'
$ nmcli connection modify id 'MyCafe' 802-11-wireless.mtu 1350
目前,我在 Ubuntu 14.04 上有:
$ nmcli --version
nmcli tool, version 0.9.8.8
...我得到:
$ nmcli con modify
Usage: nmcli connection { COMMAND | help }
COMMAND := { list | status | up | down | delete }
list [id <id> | uuid <id>]
status [id <id> | uuid <id> | path <path>]
up id <id> | uuid <id> [iface <iface>] [ap <BSSID>] [--nowait] [--timeout <timeout>]
down id <id> | uuid <id>
delete id <id> | uuid <id>
Error: 'con' command 'modify' is not valid.
$ nmcli con show
Usage: nmcli connection { COMMAND | help }
COMMAND := { list | status | up | down | delete }
list [id <id> | uuid <id>]
status [id <id> | uuid <id> | path <path>]
up id <id> | uuid <id> [iface <iface>] [ap <BSSID>] [--nowait] [--timeout <timeout>]
down id <id> | uuid <id>
delete id <id> | uuid <id>
Error: 'con' command 'show' is not valid.
那么,既然这些关键词现在不再存在,那么与nmcli con show
和语法等效的是什么呢?nmcli con modify
答案1
你的情况正好相反。这些选项是最近引入的,而不是最近删除的。Ubuntu nmcli
16.04 确实有这些选项:
$ nmcli --version
nmcli tool, version 1.2.2
$ nmcli con --help
Usage: nmcli connection { COMMAND | help }
COMMAND := { show | up | down | add | modify | edit | delete | monitor | reload | load }
show [--active] [--order <order spec>]
show [--active] [id | uuid | path | apath] <ID> ...
up [[id | uuid | path] <ID>] [ifname <ifname>] [ap <BSSID>] [passwd-file <file with passwords>]
down [id | uuid | path | apath] <ID> ...
add COMMON_OPTIONS TYPE_SPECIFIC_OPTIONS SLAVE_OPTIONS IP_OPTIONS [-- ([+|-]<setting>.<property> <value>)+]
modify [--temporary] [id | uuid | path] <ID> ([+|-]<setting>.<property> <value>)+
clone [--temporary] [id | uuid | path ] <ID> <new name>
...
nmcli
14.04(0.9.8.8)上没有这些选项,因为它们是在后来的版本中引入的。