Tcpdump will help you debug network issues by capturing packets from up to 4 individual network interfaces.
Using the Netlog facility, it is possible to copy capture files to a subdirectory, triggered by an error in another log, so the captures before and after the error will be preserved for your analysis.
You can use Wireshark on an external system for analyzing capture files.