Before looking into the Connectivity Checking feature of Ubuntu, let us first learn about Captive Portals. While trying to access Wifi facility at coffee shops, airports, business centers, hotel lobbies, etc, we find ourselves landing on a webpage that asks for authentication, payment, and/or acceptance of terms of the agreement. Only when we provide the required information are we able to access the Wifi facility. The Login page of this sort is called a Captive Portal.
Before Ubuntu 17.10, the Ubuntu server was not too good with connecting to these Captive portals so a Connectivity Checking feature was introduced. Ubuntu 17.10 and onwards, you are presented with a question mark in network status whenever a Captive Portal is detected. This new feature works by pinging the http://connectivity-check.ubuntu.com URL, time to time, in order to detect a captive portal.
If you are someone who is not much into using Public Wifi and wants to avoid these disturbing pings, you can turn off the Connectivity Checking feature. This will also stop giving technical information about your laptop to the Public Wifi server.
In this article, we will explain how you can disable/enable this Connectivity Checking behavior on your Ubuntu both through the UI and the command line.
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.
Disable Connectivity Checking through the UI
If you prefer using the GUI for performing simple administrative tasks, you can make use of the graphical Settings utility.
You can open the Settings UI either through the system Application Launcher search or by accessing it as follows:
Click on the downward arrow located at the top-right corner of your Ubuntu desktop and then click the settings icon from the following view:
The Settings utility opens in the Wi-Fi tab by default. You need to click on the Privacy tab in order to configure Connectivity Checking on your Ubuntu.
Alternatively, you can directly launch this view by entering relevant keywords such as “Privacy” in the Ubuntu Application launcher search, as follows:
This is how the Privacy view looks like:Advertisement
The Connectivity Checking feature is turned ‘On’ by default. Click on this feature and the following Connectivity Checking dialog will open:
Through this dialog, you can disable the Connectivity Checking feature by turning the slider button OFF. As soon as you configure the settings, they will immediately take action.
Disable Connectivity Checking through the Command Line
For a Terminal-savvy person who likes using the command line for most operations, you can disable/enable the Connectivity Checking feature of Ubuntu as follows:
Open the Terminal application either through the Ctrl+Alt+T shortcut or through the Application Launcher Search bar. The configuration of this feature can be changed through the /var/lib/NetworkManager/NetworkManager-intern.conf file. Open this file in one of your favorite text editors. We used the Nano editor to edit this file through the following command:
$ sudo nano /var/lib/NetworkManager/NetworkManager-intern.conf
Please remember that only an authorized user can add, remove, and configure software on Ubuntu.
Enter the password for sudo and the file will open as follows:
The .set.enabled value in the connectivity tag is where you configure this setting. Change this value to false in order to disable the Connectivity Checking feature. Then, use the Ctrl+X shortcut to quit the file.
Then, enter Y and hit Enter in order to save the changes you made to this .conf file. Finally, enter the following command as sudo in order to restart the Network Manager service.
$ sudo systemctl restart NetworkManager.service
Your changes will now be reflected in the Network Manager’s behavior. If you have the Privacy tab open in the UI, these changes will be visible once you close and re-open the settings utility, or simply when you switch to any other tab and then switch back to Privacy.
Bonus: A tip that should help
Before writing this article, I was not really sure which .conf file would need to be changed in order to enable/disable Connectivity Checking. How I figured that out is worth sharing as it would help you sometime when facing similar situations. What I did was that I changed the Connectivity Checking behavior through the UI and then immediately checked which file(s) were altered in that last one minute through the following command:
$ sudo find /var -newermt "-1 minute" -ls
The above command only lists files changed in the /var folder as this is what I was anticipating.
The results are reflecting on how I got to the /var/lib/NetworkManager/NetworkManager-intern.conf file.
After making the changes described in this article, you will no longer be bothered by the pings whenever a Captive Portal tries to register its presence and gather your connectivity information.