See the following Apple articles:
Check the status of your network on Mac
Check the status of your network on Mac - Apple Support
Â
You need to have a good Service and/or Wi-Fi.
If they are On, turn Off Hotspot &Â VPN.
(iPhone & iPad) Charge the battery > 70%.
Turn Off VPN, see -> Change VPN settings on Mac
Change VPN settings on Mac – Apple Support (UK)
Make sure you don't have a firewall enabled: Change Firewall settings on Mac – Apple Support (UK)
Â
If your Mac isn't connecting to the internet over Wi-Fi
If your Mac isn't connecting to the internet over Wi-Fi - Apple Support
Â
If you can't connect to the App Store, iTunes Store, or other Apple services
If you can't connect to the App Store, iTunes Store, or other Apple services - Apple Support