Ubuntu – the structure of network managers system-connections files

dbusnetwork-manager

could anyone list the complete structure of the configuration files, which network manager stores for known networks in /etc/NetworkManager/system-connections for known networks?

Sample (filename askUbuntu):

[connection]
id=askUbuntu
uuid=81255b2e-bdf1-4bdb-b6f5-b94ef16550cd
type=802-11-wireless

[802-11-wireless]
ssid=askUbuntu
mode=infrastructure
mac-address=00:08:CA:E6:76:D8

[ipv6]
method=auto

[ipv4]
method=auto

I would like to create some of them by my own using a script. However, before doing so I would like to know every possible option.

Furthermore, this structure seems somehow to resemble the information you can get using the dbus for active connections.

dbus-send --system --print-reply \
    --dest=org.freedesktop.NetworkManager \
    "$active_setting_path" \ # /org/freedesktop/NetworkManager/Settings/2
    org.freedesktop.NetworkManager.Settings.Connection.GetSettings 

Will tell you:

array [
  dict entry(
     string "802-11-wireless"
     array [
        dict entry(
           string "ssid"
           variant                   array of bytes "askUbuntu"
        )
        dict entry(
           string "mode"
           variant                   string "infrastructure"
        )
        dict entry(
           string "mac-address"
           variant                   array of bytes [
                 00 08 ca e6 76 d8
              ]
        )
        dict entry(
           string "seen-bssids"
           variant                   array [
                 string "02:1A:11:F8:C5:64"
                 string "02:1A:11:FD:1F:EA"
              ]
        )
     ]
  )
  dict entry(
     string "connection"
     array [
        dict entry(
           string "id"
           variant                   string "askUbuntu"
        )
        dict entry(
           string "uuid"
           variant                   string "81255b2e-bdf1-4bdb-b6f5-b94ef16550cd"
        )
        dict entry(
           string "timestamp"
           variant                   uint64 1383146668
        )
        dict entry(
           string "type"
           variant                   string "802-11-wireless"
        )
     ]
  )
  dict entry(
     string "ipv4"
     array [
        dict entry(
           string "addresses"
           variant                   array [
              ]
        )
        dict entry(
           string "dns"
           variant                   array [
              ]
        )
        dict entry(
           string "method"
           variant                   string "auto"
        )
        dict entry(
           string "routes"
           variant                   array [
              ]
        )
     ]
  )
  dict entry(
     string "ipv6"
     array [
        dict entry(
           string "addresses"
           variant                   array [
              ]
        )
        dict entry(
           string "dns"
           variant                   array [
              ]
        )
        dict entry(
           string "method"
           variant                   string "auto"
        )
        dict entry(
           string "routes"
           variant                   array [
              ]
        )
     ]
  )
]

I can create new setting files using the dbus (AddSettings() in /org/freedesktop/NetworkManager/Settings) passing this type of input, so explaining me this structure and telling me all possible options will also help. Afaik, this is a Dictionary{String, Dictionary{String, Variant}}.

Will there be any difference creating config files directly or using the dbus?

Best Answer

That file isn't meant to be edited by the user, but by the Network Manager tools. You can read the manual using:

man nm-settings

FILES

  /etc/NetworkManager/system-connections

  or distro plugin-specific location

The list is too long/extensive and could change any moment, so using the manual page is recommended since it is synchronized with your NM version.

Related Question