Occasionally my PS3 refuses to sign in. After trawling through a billion pages I finally found the solution.
Change your DNS servers to 188.8.131.52 or/and 184.108.40.206
All the other settings don’t really make any difference. My router was even set up to put the PS3 in DMZ (Demilitarised Zone) which didn’t help at all. The fault really lies with your ISP, apparently. My original DNS was 220.127.116.11 and 18.104.22.168.
Thanks to amstel78 from the PSN forums.