Ubuntu – Detect internet connection

internetnetworking

On Windows, if there's no internet connectivity for whatever reason and the connection to the network is perfectly fine, a small icon shows on the network icon in the notification area. Is there any way to do the same on Ubuntu?

Even that is not necessary, I just want to know what ways are there to find if the internet connection is lost or not.

No ping to x website please, I've faced a few instances of DNS outage and ping failure can be due to DNS down time, not internet connectivity.

UPDATE

Thanks for all those interesting answers. My actual aim of this question was to know if there was a method to know the status of my connection at the local level (connection between the machine and AP), which is why I said no ping to x website please. The LAN private address that was mentioned by Alain is something that comes close. If I can diagnose that, I can rule out AP/network issues, then move onto diagnosing the actual connection to my ISP.

Best Answer

The command ip link show shows the status of available interfaces. At least one of the interfaces on needs be listed as UP in order for you to have any connectivity at all.

The command ip neigh show shows local link state, like this:

192.168.0.1 dev eth0 lladdr 00:15:e9:ec:cc:80 REACHABLE

You need at least one REACHABLE to have network access.

The command ip addr show shows all interfaces and their IP addresses.

Once you have a local IP address and a neighbor's IP address, you can then use ping or another tool to verify local IP connectivity.

Related Question