Along with other developer I am creating a script to automatically update Linux systems as long as they are not connected to metered connections.

But we have found that some systems would use "systemd-networkd" instead of network-manager for configuring the network, and having both programs will conflict with each other.

So we can't really rely on nmcli being installed on the system, and using the solutions of this question.


There is no single sure way to automatically detect that. There are some ways for the network to give a hint that it's metered, but those methods are nowhere near ubiquitously deployed.

But when those hints are not present, you cannot assume that the connection is not metered; it might or might not be. With NetworkManager, the "metered connection" attribute can be set by the user when configuring the connection, since the user may best know the status of the connection.

So, you might just give the user the choice/responsibility to either run your script or to disable it.


As @telcoM stated, there is no sure way to determine whether a connection is metered. An additional option would be to set-up a table of known connections and whether or not they are metered. A relatively good indicator for this is the external IP address, which you can determine with

dig +short myip.opendns.com @resolver1.opendns.com

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.