Check status.playstation.com to see if PSN is down; if it shows no problems, restart your console, router and modem and test ...
There are many reasons for this problem; one of the reasons is that Windows Update failed to install or update the Network drivers, in that case, you have to update the required driver manually.