1

I am using "nmcli networking connectivity" command to know the connectivity of my wifi connection. After establishing the connection with a wifi & if I see that it has no internet connection then "nmcli networking connectivity" show "limited" which is quite natural. But when that wifi connection got internet connection back and then if I run "nmcli networking connectivity" then also I am getting "limited" instead of "full". I have rescanned the network and also wait for few seconds and then run the command but I got the same result.(i.e. limited)

But if I reconnect with the wifi by running "nmcli device wifi connect [SSID] password [wap_key]" & then try to see the network connectivity then I got "full"

So, that means every time I want to check the the network connectivity I have to reconnect with the wifi (which is not desired). Is it so?

If not then please tell me suitable method (linux command, not via gui or not via ping, system command is more acceptable) to check whether my wifi has internet access or not. [any c/c++ code is also acceptable]

0

1 Answer 1

0

I think you just missed the argument check. This argument rechecks the connectivity.

    nmcli networking connectivity check

From man pages

   connectivity [check]
       Get network connectivity state. The optional check argument tells NetworkManager to
       re-check the connectivity, else the most recent known connectivity state is displayed
       without re-checking.

       Possible states are:

       none
           the host is not connected to any network.

       portal
           the host is behind a captive portal and cannot reach the full Internet.

       limited
           the host is connected to a network, but it has no access to the Internet.

       full
           the host is connected to a network and has full access to the Internet.

       unknown
           the connectivity status cannot be found out.

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.