I think this is a bad question posted by me because of downvote I got because the question doesn't make much sense. Ping error and internet problem could kick in due to various problems.
But I faced this situation again today on a vanilla Arch Linux ARM installation.
I never had problem with my other x86_64 PC all running Arch Linux.
A short note
I was running fine on my WiFi. But I faced the problem when I connected to phone's hotspot today. As a result the
/etc/resolv.conf generated by networkmanager changed. Same on my laptop, but my laptop has internet connection.
The problem is [temporarily] solved by stopping the
sudo systemctl stop systemd-resolved
Right, when I start the service, I lose my internet connection, when I stop it, I get my connection back.
So to make permanent changes, I disabled it, and everything is A-Ok!
sudo systemctl disable systemd-resolved
This also saved my day on the previous installation!
Although this problem is seen on Arch Linux ARM on Rapsberry Pi 3 model B, I have no idea about other models. I am using Arch Linux ARM for Raspberry Pi 2/3 (and not the image for version 3)
This is a fix for me because I had problem with the name resolution. Your problem could be different. This is just a possibility that could disconnect you from the internet. There could be a boatload of other reasons why you lost your internet connection.
Hope this helps!