Ways to quickly check if you are connected to the internet while on an internal network

I need some help thinking of ways to quickly check if I am connected to the internet while on an internal network. I never lose connection to the internal network but for some annoying reason I lose the internet quite often. I don't get any errors or warnings. I usually find out that I have lost my internet connection when my youtube playlist stops playing. I'm sure there is a way to quickly do this.

ping an external site.

ping unix.com

Any ideas on script form of this so I don't have to constantly check? This is what I was thinking. Not very creative but I am sure there are better ways to do this.