NetworkManager/src/nmcli
Beniamino Galvani b4dde691ec nmcli: add support for managing wireguard peers
Even if WireGuard is supported since long time in NetworkManager, it
is still not possible to manage the list of peers via nmcli. The
reason is that in the past we wanted to introduce a special syntax
that would allow to manage the peer list more easily. However, this
requires heavy changes to the nmcli output formatting code, and so it
never happened.

Since perfection is the enemy of good, abandon the idea of a custom
handling of peers and treat them as any other composite property. The
property is named "wireguard.peers" and exposes the peers indexed by
public key, with optional attributes.

Example:

  $ nmcli connection modify wg0 wireguard.peers "8Wgc1a0jJX3rQULwD5NFFLKrKQnbOnTiaNoerLneG1o= preshared-key=16uGwZvROnwyNGoW6Z3pvJB5GKbd6ncYROA/FFleLQA= allowed-ips=0.0.0.0/0 persistent-keepalive=10"
  $ nmcli connection modify wg0 +wireguard.peers "fd2NSxUjkaR/Jft15+gpXU13hKSyZLoe4cp+g+feBCc= allowed-ips=192.168.40.0/24 endpoint=172.25.10.1:8888"
  $ nmcli -g wireguard.peers connection show wg0
  8Wgc1a0jJX3rQULwD5NFFLKrKQnbOnTiaNoerLneG1o= allowed-ips=0.0.0.0/0 persistent-keepalive=10, fd2NSxUjkaR/Jft15+gpXU13hKSyZLoe4cp+g+feBCc= allowed-ips=192.168.40.0/24 endpoint=172.25.10.1\:8888
  $ nmcli connection modify wg0 -wireguard.peers 8Wgc1a0jJX3rQULwD5NFFLKrKQnbOnTiaNoerLneG1o=
  $ nmcli -g wireguard.peers connection show wg0
  fd2NSxUjkaR/Jft15+gpXU13hKSyZLoe4cp+g+feBCc= allowed-ips=192.168.40.0/24 endpoint=172.25.10.1\:8888
2025-06-16 13:20:02 +02:00
..
agent.c cli: drop _NMC_RL_STARTUPHOOK_ARGS 2025-05-20 09:54:31 +02:00
common.c cli: drop _NMC_RL_STARTUPHOOK_ARGS 2025-05-20 09:54:31 +02:00
common.h cli: drop _NMC_RL_STARTUPHOOK_ARGS 2025-05-20 09:54:31 +02:00
connections.c nmcli: improve the warning message about no controller found 2025-04-14 10:08:01 +00:00
connections.h nmcli: connection: process port-type, type and controller first 2025-04-14 10:08:01 +00:00
devices.c nmcli: connection: process port-type, type and controller first 2025-04-14 10:08:01 +00:00
devices.h src: drop most master references from the code 2024-08-09 15:47:32 +02:00
gen-metadata-nm-settings-nmcli.c ethtool: support Forward Error Correction(fec) 2024-11-07 17:38:04 +08:00
gen-metadata-nm-settings-nmcli.xml.in nmcli: add support for managing wireguard peers 2025-06-16 13:20:02 +02:00
general.c nmcli: print to stderr where appropriate 2025-02-20 09:13:01 +00:00
meson.build nmcli: rename "generate-docs-nm-settings-nmcli" to "gen-metadata-nm-settings-nmcli" 2022-10-31 09:11:30 +01:00
nmcli-completion nmcli: fix argument completion if nmcli is aliased 2025-03-24 14:29:19 +00:00
nmcli.c nmcli: fix bash completion for fields 2024-08-28 15:44:01 +02:00
nmcli.h nmcli: move offline flag from NmCli to NmcConfig struct 2023-07-17 12:56:03 +02:00
polkit-agent.c nmcli: replace all uses of g_print()/g_printerr() with nmc_print()/nmc_printerr() 2023-02-08 10:11:18 +01:00
polkit-agent.h cli: move from "clients/cli/" to "src/nmcli/" 2021-03-15 17:10:54 +01:00
README.md all: add some README.md files describing the purpose of our sources 2021-08-19 17:51:11 +02:00
settings.c nmcli: print to stderr where appropriate 2025-02-20 09:13:01 +00:00
settings.h nmcli: convert everywhere dhcp-send-hostname <-> dhcp-send-hostname-v2 2024-10-24 17:03:10 -04:00
utils.c nmcli: convert everywhere dhcp-send-hostname <-> dhcp-send-hostname-v2 2024-10-24 17:03:10 -04:00
utils.h format: run nm-code-format 2024-10-04 11:07:35 +02:00

nmcli

The command line user interface of NetworkManager. It uses the D-Bus API of NetworkManager (via libnm).

See:

  • man 1 nmcli ([www])
  • man 7 nmcli-examples ([www])
  • man 5 nm-settings-nmcli ([www])

Try also with bash-completion!