Sunday, April 12, 2009

Can't send email and have a router here's a tip

I had a friend call me up today with computer trouble. It is a common problem that people experience with routers. I figured I would post the reasons this occurs and a fix for it so that others might benefit from it.

The problem was that he was able to receive emails but not send them. This usually occurs when one has a router because the information leaving the router is getting scrambled. In order to explain this I'll have to explain how TCP/IP the language of the internet works (very simplified version)



I'm tempted on talking about the tubes now but I'll refrain ;-)




TCP/IP stands for Transmission Control Protocol and Internet Protocol. It is what is used to send and receive information over the internet. It is made of different layers the:
  1. Link Layer
  2. Internet Layer
  3. Transport Layer
  4. Application Layer.
For the purposes of our discussion we are only going to concern ourselves with the transport layer. The Transport Control Protocol allows information to be broken up into smaller pieces called packets. So lets say we were sending an email that has an attachment. We'll say this attachment is 10 KB or 10 Kilobytes. Some people prefer to refer to this as 10 KiB or 10 KilobInary Bytes as it actually refers to 10240 bytes or 1024 x 10 bytes. I will refer to the shorter version from here on in, simply by virtue of being stuck in my ways. ;-)

The default MTU or Maximum Transmission Unit is 1492 this determines what size chunks the information is broken up into when sending. So in the case of IPv4 the first 20 bytes are header which leaves 1472 bytes for data and checksum. Inside the TCP datagram we have 20 bytes for the tcp header. Which leaves 1452 Bytes for data. So a file of size 10240 would be broken up into 8 packets (10240 divided by 1452 is 7 and a bit so rounding up we get 8 packets).
Now here's where the problem arises, if there is an error in the packet the packet has to be resent, what happens with a larger packet size is there is more likelihood to have an error the more bits there are in a packet. So the mail agent keeps trying to send a packet that ends up getting mangled. Once the size or MTU is lowered the packet sends because there is less likelihood of an error, and the email can be sent.

So for example on a linksys router:



You would change the MTU drop down tab to Manual, and then change the size by reducing the default 1492 to 1452 to see if that decreases the error rate.



Next try to send an email with an attachment, if the send error disappears you are set, if not reduce the MTU value by 10.

There is a more in depth way of doing this so that you can optimize this setting, but this is the easiest way for the average user who doesn't want to get too complicated and start checking for packet fragmentation/mangling.

Hope this helps...until next time

Nerdtek signing off.