Get current network parameters via NetworkManager CLI

The nmcli program allows terminal (CLI) access to current network parameters. For example, to get current DNS server:

nmcli dev show | grep DNS

This will return something like:

IP4.DNS[1]:                             1.1.1.1
IP6.DNS[1]:                2606:4700:4700::1111

Python

NMCLI output is made for machine parsing. An example of nmcli Python parsing is our “MozLoc” program that allows locating via nearby WiFi APs alone, using Mozilla Location Service.