What is the structure of network managers system-connections files?

Posted by Oyks Livede on Ask Ubuntu See other posts from Ask Ubuntu or by Oyks Livede
Published on 2013-10-30T15:47:58Z Indexed on 2013/10/30 16:11 UTC
Read the original article Hit count: 406

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?

© Ask Ubuntu or respective owner

Related posts about networking

Related posts about network-manager