Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 1013  / 1 Year ago, wed, march 15, 2023, 4:06:25

/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.


More From » networking

 Answers
2

@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.




[#995] Wednesday, March 15, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
anoalk

Total Points: 271
Total Questions: 90
Total Answers: 112

Location: Zambia
Member since Wed, Dec 16, 2020
3 Years ago
anoalk questions
Fri, Sep 24, 21, 02:59, 3 Years ago
Sat, Mar 5, 22, 02:33, 2 Years ago
Tue, Mar 22, 22, 07:19, 2 Years ago
Thu, Feb 16, 23, 16:27, 1 Year ago
;