If your PS4 shows failed to login try to connect to a different Wifi (propably to your phone by enabling tehernet and Mobile Hotspot
) if it worked then the problem could be from your router.
Call your ISP
and ask them to change your router to public IP
I have changed my router twice and it worked for a week but the problem keeps reoccurring until I requested my ISP to change the current default setting to a public IP.