PSN error code NP-40831-6 appears to be an internet connection error. It may also be a problem with your IP address and Sony may have identified it as a potential threat.
1. Connect using Mobile Data
“PSN error code NP-40831-6” may be a result of the latest system update. The system update might have altered your network configuration to your modem router or your console. To validate the cause try to use your mobile phone data as an internet source for your console by turning on the mobile phone data and hotspot then connect via PS4 WiFi.
If you successfully signed in, this confirms that the system update was able to alter something your console or home network configuration. It could have altered or create a cache problem. To fix this turns off your modem router and your PS4 for at least 30 seconds and turns it back on. This process may clear the modem router and PS4 cache. Then connect your console back to your home network.
NOTE: If you are able to sign in using your Mobile Hotspot, try to reconnect again to your home network without turning the modem router and the PS4. It works sometimes with this error.
If the issue persists, update your modem router firmware or call your ISP to do this stuff. It may be due to your modem which is not compatible with the recent PS4 system update.
2. Request for a Static IP from the ISP (Internet Service Provider)
“PSN error code NP-40831-6” may be due to the IP address was given by your ISP. It could be blocked or consider as a treat on the PSN server side. You may want to call you ISP to request a static IP address. However, your ISP might charge you an additional monthly fee. If you would not like the additional fee, you may want to restart your modem router until you obtain an IP that is not block or consider treat to PSN server. To check your IP check this link here.