If your PS4 is having IP connection troubles you'll need to figure out whether or not the router is the problem, then act accordingly (though using a wired ethernet connection, if you're able, may also circumvent the problem). Try restarting the router, restarting the PlayStation, and if nothing else works make the PlayStation "forget" the connection and then set it back up again. If the problem persists, set up a static IP by opening your PS4 Settings > Network > Set Up Internet Connection > Use Wi-Fi > Easy > IP Address Settings > Manual. Enter values for your IP address, Subnet Mask, etc, set MTU to Automatic, and set Proxy Server to Do Not Use.