Sony Computer Entertainment mentioned today that the PlayStation Network is back online, but there are many that are still unable to get their PS4 connected.The official AskPlayStation Twitter account posted a couple possible fixes

Unfortunately there's a chance that the fixes mentioned above won't work for you. In that case, there's another one (suggested by NeoGAF user k0ji-wd) that might temporarily fix your situation.

Go to Settings -> Network -> Set Up Internet Connection on your PS4, select “Custom,” leave all your settings as they were, but change MTU to 1476.

For example, if you're using a LAN cable, select Use a Lan Cable -> Custom -> Automatic -> Do Not Specify -> Automatic -> Manual -> Set MTU to 1476 and confirm with Next -> Do Not Use -> Test Internet Connection.

It worked for me and for many others, and it should get you online immediately. If 1476 does not work, try 1473.

The setting first proved effective yesterday morning, then stopped working in the afternoon as the network went fully down again, and restarted working today as it was brought back up. Apparently, it's effective only if the network is up but you can't connect yet, for unknown reasons.

This fix will allow you to play online, but some features like the "what's new" area might be unusable.

Just remember to set your setting back to automatic or the MTU to the original 1500 when Sony will finally manage to fully solve the issues, as the 1476 value is not optimal.

Update: this fix has been officially endorsed by Sony.

Update 2: apparently connectivity is very spotty at the moment of this writing, meaning that this fix may or may not work for you. It's worth mentioning that a failed connectivity check doesn't necessarily mean the PS4 won't connect online. A better indicator is whether you see your friend list or not after setting the relevant values.  For instance, my PSN Sign-in test fails, but i'm still connected and my console works normally.