I'm using Mac OS X Lion and I've been having this problem with FTP (any FTP client, mind you. I tried Transmit, FileZilla, Cyberduck and the Terminal, all with the same result)

I can browse files in my FTP Client, but when I upload files, the client hangs for a few seconds, then thinks it uploaded the files successfully, but it only creates a new file with one blank line in it. Sometimes, it manages to upload 4-5 lines.

It then returns:

226 - Error during read from data connection
226 Transfer aborted

But 2xx is a success message. It is not a server issue, since any Windows machine will upload just fine using the same network. Can anybody figure out what the problem is? It renders my Mac useless for web development.

The problem persists with SFTP and FTP with SSL/TLS.


The problem goes away when you take the router and connect directly through PPPoE.

At first blush the problem is with the router. But no, the problem is with the Mac that connects through a router that connects through a PPPoE and tries to upload using FTP. Pretty specific, I know.

The problem is with the MTU (maximum transmission unit). Apparently, Mac OS X breaks the file into chunks that are too large for the router to send, because the router's MTU was set lower than Mac OS X's.

The router here was 1492, which is okay, but where the Mac's MTU is 1500, this is unacceptable. Don't really understand why it works directly with PPPoE.

If you encounter the same problem, this is how you diagnose and fix it:

In terminal, run the following to see what the MTU is for en0 (or en1, mine was en0):

ifconfig | grep mtu

If it's 1500, run

sudo ifconfig en0 mtu 1300

This should solve it.

If so, it may only be until the next restart. You can also change the MTU in System Preferences \ Network \ Ethernet -> Advanced \ Hardware

Later edit:

One-line fix (if you want to use it as an Alfred Extension or run it at startup, replace with your sudo password):

echo <password> | sudo -S ifconfig en0 mtu 1300;

Not the answer you're looking for? Browse other questions tagged or ask your own question.