NetworkManager 介绍

发布时间: 更新时间: 总字数:480 阅读时间:1m 作者: IP上海 分享 网址



  • ubuntu
apt-get install -y NetworkManager NetworkManager-tui



nmcli -h ...
$ nmcli -h
Usage: nmcli [OPTIONS] OBJECT { COMMAND | help }

  -a, --ask                                ask for missing parameters
  -c, --colors auto|yes|no                 whether to use colors in output
  -e, --escape yes|no                      escape columns separators in values
  -f, --fields <field,...>|all|common      specify fields to output
  -g, --get-values <field,...>|all|common  shortcut for -m tabular -t -f
  -h, --help                               print this help
  -m, --mode tabular|multiline             output mode
  -o, --overview                           overview mode
  -p, --pretty                             pretty output
  -s, --show-secrets                       allow displaying passwords
  -t, --terse                              terse output
  -v, --version                            show program version
  -w, --wait <seconds>                     set timeout waiting for finishing operations

  g[eneral]       NetworkManager's general status and operations
  n[etworking]    overall networking control
  r[adio]         NetworkManager radio switches
  c[onnection]    NetworkManager's connections
  d[evice]        devices managed by NetworkManager
  a[gent]         NetworkManager secret agent or polkit agent
  m[onitor]       monitor NetworkManager changes


nmcli nm wifi off|on
nmcli radio wifi off|on

nmcli d
nmcli dev
nmcli dev wifi
nmcli dev wifi list
nmcli dev status
nmcli device wifi

# 链接wifi
nmcli dev wifi connect <wifi-name> password <wifi-password> iface wlan0
nmcli dev wifi connect <wifi-name> --ask

# 断开热点
nmcli dev disconnect iface wlan0
nmcli connection show --active
  • nmtui
  • /etc/sysconfig/network-scripts
    • ifcfg-xxx 修改后,需要 nmcli con reload 激活配置
  • nmcli
    • nmcli con show 显示所有connections
    • nmcli con show enoxx 显示connection的所有properties。 man nm-settings
    • nmcli dev status 显示所有devices
    • nmcli con add 创建connection
    • nmcli con up 激活connection
    • nmcli con mod 修改connection参数
    • nmcli命令太多记不住,有个办法: man nmcli-examples
  • ip命令的操作都是临时的,要想持久化,要用nmcli或nmtui
Home Archives Categories Tags Statistics
本文总阅读量 次 本站总访问量 次 本站总访客数