Score:0

Explaination of files under /etc/NetworkManager?

ru flag

/etc/NetworkManager is an important directory where NetworkManager saves its configs. I want a complete list of what every file is for.

All files under this directory on my laptop is

$ tree
.
├── conf.d
├── dispatcher.d
│   ├── no-wait.d
│   ├── pre-down.d
│   └── pre-up.d
├── dnsmasq.d
├── dnsmasq-shared.d
├── NetworkManager.conf
└── system-connections
    ├── Family 2.nmconnection
    ├── Starbucks.nmconnection
    ├── StudentOffice.nmconnection
    └── SunYouran.nmconnection

I believe that by answering this question, I can have a better understanding of how the network works in Ubuntu.

24601 avatar
in flag
Ask ubuntu is a Q&A site - I don't see a question here.
24601 avatar
in flag
I’m voting to close this because there is no question submitted
Youran avatar
ru flag
@24601 The question naturally arises in the discussion: "what do files under `/etc/NetworkManager` do". It is like "what is every directory under root, such as `/etc`, `/log`, used for, but much specific.
vanadium avatar
cn flag
The point of the comments is: you should ask the question, but then write out the answer as an Answer, not as part of the body of your question. So edit your question to retain only the problem, then copy the answer in a separate Answer and you will be fine. Otherwise will need to be closed.
waltinator avatar
it flag
Use the standard Software WTF Procedure: For each file you're concerned with, `dpkg -S filename` shows which package provided the file. For each package listed above, `dpkg -L package` will show all the files installed by the package. Read the `README*` files, investigate the others (`file`, `less`,`readelf`,...).
Youran avatar
ru flag
@vanadium I remembered that when I search answers on StackOverflow, it is painful to read very long questions. So I agree to move major things into the answer and keep the question brief.
Youran avatar
ru flag
@waltinator Thank you! I used to search blindly on the internet and read `man package`. Now I know `dpkg` can provide lots of information.
Score:0
ru flag

@vanadium provided a general way for investigating files' usage.

  1. For each file you're concerned with, dpkg -S filename shows which package provided the file. Directories can also be fed into filename, but a full path to the directory is needed.
  2. For each package listed above, dpkg -L package will show all the files installed by the package.

So for files under /etc/NetworkManager

  • dispatcher.d

    All execute scripts in this directory or its subdirectories will be executed by NetworkManager in alphabetical order in response to network events. Each script receives two arguments, the first being the interface name of the device an operation just happened on, and second the action. For example, the following script disable offload features of temporary network adapters

    #!/bin/bash
    # file: /etc/NetworkManager/dispatcher.d/80-disable-offload.sh
    # usage: diable offload when eno1/enp0s31f6 is up
    interface=$1
    event=$2
    if [[ $interface == "eno1" || $interface == "enp0s31f6" ]] && [[ $event == "up" ]]; then
      TOE_OPTIONS="rx tx sg tso ufo gso gro lro rxvlan txvlan rxhash"
      for TOE_OPTION in $TOE_OPTIONS; do
          /sbin/ethtool --offload $interface $TOE_OPTION off
      done
    fi
    exit 0
    
  • NetworkManager.conf

    The default content on my machine is

    [main]
    plugins=ifupdown,keyfile
    dns=default
    
    [ifupdown]
    managed=false
    
    [device]
    wifi.scan-rand-mac-address=no
    

    where

    • ifupdown is the plugin used on the Debian and Ubuntu distributions, and reads Ethernet and Wi-Fi connections from /etc/network/interfaces.
    • keyfile is the generic plugin that supports all the connection types and capabilities that NetworkManager has. It writes files out in an .ini-style format in /etc/NetworkManager/system-connections.
    • [ifupdown] manage is set to false as default. If set to false, then any interface listed in /etc/network/interfaces will be ignored by NetworkManager. (My question: how can network-manager manager networks as this is set to false?)
  • conf.d

    Users can add additional .conf files to this directory because NetworkManager.conf may be erased by a software update.

  • system-connections stores information about connections such as wifi. It is managed by keyfile plugin as explained above. These are the connections one edits in nmtui.

  • dnsmasq.d and dnsmasq-shared.d

    When the dnsmasq plugin is enabled, files in these two folder controls its behavior. For an example of how to enable it and a simple configuration, see Using the NetworkManager’s DNSMasq plugin.

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.