Ubuntu SSH connection hangs when I run ifconfig with IPv6 enabled

That sounds like a MTU issue - perhaps the extra IPv6 addresses in the ifconfig output tipped the packet size over the MTU limit and the session hangs.

Does the hangup happen with any other long-listings? Perhaps when running top? Or when copying files to/from the host? Check the link, it explains what a MTU problem is and what you can do about it.


I don't know what exactly happens in your case, but I'll try to describe steps to troubleshoot this issue.

  • Check the logs of the ssh daemon. Increase the level of logging. Maybe it'll help to find the cause.
  • Don't use the ifconfig. It's deprecated. Otherwise extend the question and provide the complete command, that you run.
  • Use the gnu screen or the tmux. It keeps your programs running. Otherwise after disconnection the user session is closed and all programs in this session will be terminated. But they should be run to move forward to the solution.
  • In screen session run the ip monitor command. It shows most of changes and events in the network configuration. In the other screen console run your ifconfig command. What the ip monitor command has shown?
  • If the previous step doesn't help, run the tcpdump also under the screen. You can write the capture into the file with the -w option to open it later in the wireshark. Analyze the traffic capture in the wireshark. It requires some knowledge of the TCP, but it shouldn't be very complicated. Your first task in this step is determine what happens with your SSH connection.

I think the steps above will help you in most cases. Extend the answer and I'll try to help you.