SSH session gets clogged/stuck | Day in my life

June 18, 2012

SSH session gets clogged/stuck

This happens to me all the time, when I’m connected over VPN or sometimes from outside network. If you are new to *nix world and using a headless terminal immediate reaction is ‘shit my system hung’.

You wont notice this until you execute commands like tail, head, ls, emacs, vi etc… any if it trying to load a larger data set. Problem  is not with the box you are on or the box you are connecting to but with the network. When two machine communicate they decide on data packets size. All is fare if you are on the same network or all connected devices speak the same size. If any of the intermediary nodes decides to chop the size of you would see this issue. Read all about ‘Maximun Transmission Unit’ or ‘mtu’ at wikipedia.

How to identify if ‘mtu’ is the problem

    $ sudo ifconfig

From the output of above command check the ‘mtu’ value of the interface you are connecting over.  If its something else than 1500 it could be an issue. In my case I was connecting over PPP0 and it had value other than 1500. (see screenshot)

How to fix it on *nix

$ sudo ifconfig <mtu_value>  

“mtu” value can be set to anything that would work best for you. Usually these are the know values that are in wide use 1450, 1400, 1300.

Read more about related material
- http://en.kioskea.net/faq/2093-introduction-to-mtu
- http://support.apple.com/kb/HT2532
- http://www.ubuntugeek.com/how-to-change-mtu-maximum-transmission-unit-of-network-interface-in-ubuntu-linux.html

© Nataraj Basappa 2018