Start by testing your network connection with the following steps:
1. Start at the PS4 Main Menu
2. Select Settings
3. Select Network
4. Then select Test Internet Connection Test
If this test shows your connection as NAT type 3, then you will most likely have some sort of interference within your connection to the online servers.
Note: You can visit the Sony PS4 manual website for additional details regarding the connection test http://manuals.playstation.net/document/en/ps4/settings/nw_test.html
If you have NAT type 3, please try the steps below:
1. Restart your network hardware. Turn off your PS4, Modem, and Router and wait about 15 - 30 seconds
2. Fully power up your modem
3. Fully power up your router
4. Turn on your PS4 and test the network connection again
At this point if you still have trouble then you may have a firewall interfering with your connection. Please configure the following network ports and enable UPnP through your router.
PlayStation Network Required Ports
UDP: 3658, 9103, 11000, 11001, 11002, 11005
Finally, if this does not solve your problem, try establishing a direct connection to your modem (bypass the router) and retry.