NetworkManager is a software utility for configuring and managing network interfaces. It is developed by the Gnome project and is used in many distributions and by many Desktop Environments. The stated goal of NetworkManager is to make setting up and configuring networking as automatic and painless as possible, so that it just works. To aid in this goal NetworkManager can perform connectivity checking in order to determine whether your network has full internet connectivity.
The purpose of this is primarily to determine whether the network you are using implements a captive portal. Many public Wi-Fi connections implement captive portals where the user must first sign in or agree to the terms and conditions before full internet access is granted. As a result, NetworkManager’s connectivity checking feature enables the captive portal to be presented to the user easily so that they can use the public Wi-Fi without much fuss.
The way that the connectivity checking works is by performing an HTTP request to a distribution defined URI. If the request is successful then NetworkManager assumes that you have full internet connectivity, otherwise it assumes that you are behind a captive portal. By default, this request is sent once every 300 seconds. Some users may find this behavior undesirable as it enables both the server and anyone who is in a position to monitor network activity to determine information that may be considered private. Connectivity checking enables them to determine that your machine is on and connected to the internet. It also enables them to determine what distribution you are using and that you are in fact using NetworkManager.
Depending on your use case and threat model this may either be considered an insignificant risk that is worth captive portal detection working seamlessly or a completely unnecessary risk that is best avoided. If you use NetworkManager on your laptop and frequently take it to cafes and other public places to use their Wi-Fi then it may be best to leave connectivity checking on, or at least turn it back on when necessary. Conversely, if you use NetworkManager on a desktop or server that is stationary and plugged into Ethernet then it may make sense to disable connectivity checking. We will look at how to turn off NetworkManager connectivity checking on two popular distributions, Ubuntu version 20.04 and Arch Linux.
In this tutorial you will learn:
- How to turn off NetworkManager Connectivity Checking on Ubuntu 20.04
- How to turn off NetworkManager Connectivity Checking on Arch Linux
Software requirements and conventions used
|Category||Requirements, Conventions or Software Version Used|
|System||Ubuntu, Arch Linux|
|Other||Privileged access to your Linux system as root or via the |
|Conventions||# - requires given linux commands to be executed with root privileges either directly as a root user or by use of |
$ - requires given linux commands to be executed as a regular non-privileged user
How to turn off NetworkManager Connectivity Checking on Ubuntu 20.04
By default, Ubuntu 20.04 establishes an http connection to http://connectivity-check.ubuntu.com once every 300 seconds as described above. In Ubuntu you can easily turn off connectivity checking through a user friendly user interface. To do so follow the directions below.
To turn off connectivity checking in Ubuntu 20.04 click the upside down triangle in the top right-hand corner and then click
Settings. Next, click
Privacy and then click
You will see a toggle for
Connectivity Checking. Simply turn this toggle off and you have turned off NetworkManager’s connectivity checking feature.
When you change this toggle, what is actually happening behind the user interface is that a value in a configuration file is being changed.
If you examine the contents of the /var/lib/NetworkManager/NetworkManager-intern.conf file before and after toggling this option then you will see that the
.set.enabled=true setting under
[connectivity] changes to
.set.enabled=false after toggling the
Connectivity Checking option off in the user interface. With this in mind, if you prefer to use the terminal to change this setting then you can simply edit the file yourself by following the steps outlined below.
First, using your preferred text editor, open the /var/lib/NetworkManager/NetworkManager-intern.conf file with root privileges.
$ sudo vim /var/lib/NetworkManager/NetworkManager-intern.conf
Next, change the following value in the relevant setting from
Change the following
Finally, restart the NetworkManager service like so.
$ sudo systemctl restart NetworkManager
After following the steps above, if you look at the
Connectivity Checking setting in the
Settings GUI then you will see that the setting has been toggled off.
How to turn off NetworkManager Connectivity Checking on Arch Linux
Overriding the connectivity checking settings for NetworkManager in Arch Linux looks a bit different compared to Ubuntu. Unlike Ubuntu, Arch Linux let’s the user choose the Desktop Environment and set of packages that they are using, so you may not even be using NetworkManager on your Arch system. If you elected to install NetworkManager or a Desktop Environment that uses it then by default Arch establishes a connection to http://www.archlinux.org/check_network_status.txt every 300 seconds as described in the intro.
The Arch project acknowledges that automatic connectivity checks are a potential privacy leak, but they state that they are committed to not logging any access in order to minimize the risk. That commitment prevents Arch from associating you with the connections to their servers, but it still allows anyone who is in a position to monitor network activity to determine information that may be considered private. The recommended method to override this setting and turn off connectivity checking completely is to create a new file with your preferred configuration. The file you must create is /etc/NetworkManager/conf.d/20-connectivity.conf.
First create the new file using your preferred text editor.
$ sudo vim /etc/NetworkManager/conf.d/20-connectivity.conf
As per the
CONNECTIVITY SECTION of the NetworkManager man page there are a number of ways to disable connectivity checking within this configuration file. We will use the method that changes the
interval setting in order to disable it. The
interval setting configures how often NetworkManager pings the
uri specified. By default this value is
300, meaning once every 300 seconds. If we change this value to
0 then NetworkManager will never ping the
uri specified, thus disabling connectivity checking. Enter the following into the file that you just created (/etc/NetworkManager/conf.d/20-connectivity.conf) and then save it.
[connectivity] uri=http://www.archlinux.org/check_network_status.txt interval=0
Next, restart the NetworkManager service
$ sudo systemctl restart NetworkManager
Now NetworkManager Connectivity Checking is disabled on your Arch Linux system.
In this article we discussed the connectivity checking feature of NetworkManager. We examined what it is, why it exists, and why you may not want to keep it enabled. We discussed the pros and cons of disabling the feature and then we then examined how to disable it on Ubuntu and Arch Linux. Whether you decide to leave connectivity checking enabled or disable it, we think that it is important that you know about this feature and we hope that this knowledge empowers you to make the decision that is right for you.