Perform an Internet connection test by selecting Settings > Network > Test Internet Connection.
If you are using a wireless connection, try bringing your PlayStation®4 console closer to your router and removing anything interrupting the connection between the devices.
Turn off your router, wait at least 5 minutes, then restart it.
Try using a wired connection if possible.
Update your router to the latest firmware. For details on how to update, please contact the router manufacturer.
If possible, try opening the ports. TCP: 80, 443, 3478, 3479, 3480 and UDP: 3478, 3479, 49152 to 65535. For details on how to open ports, please contact your Internet Service Provider.