echo 2 > /proc/sys/net/ipv4/tcp_mtu_probing able to resolve my issue but why ? What this command does?
According to man 7 tcp
:
tcp_mtu_probing (integer; default: 0; since Linux 2.6.17):
This parameter controls TCP Packetization-Layer Path MTU Discovery. The following values may be assigned to the file:
0 Disabled
1 Disabled by default, enabled when an ICMP black hole detected
2 Always enabled, use initial MSS of tcp_base_mss.
It means that once enabled, your OS try to find the MTU between your client and your server using Path MTU discovery mechanism. It probably increase the default MTU (1500 on Linux) in your case, allowing bigger packets to be sent.
You can check the MTU on your interface by running ip a
:
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN # <= here MTU is 16436 bytes
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
# below MTU is 1500 bytes
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UNKNOWN qlen 1000
link/ether 00:0c:29:28:fd:4c brd ff:ff:ff:ff:ff:ff
inet 192.168.50.2/24 brd 192.168.50.255 scope global eth0
inet6 fe80::20c:29ff:fe28:fd4c/64 scope link
valid_lft forever preferred_lft forever
This was a strange behaviour that you couldn't transfer files as IP fragmentation and TCP segmentation normally take care of chunking your file before sending it over the network. Maybe you should check what are the default fragmentation/segmentation configuration on your machine.
Comments
-
Vaibhav Ajay Gupta almost 2 years
I was not able to upload files larger than 1.2 kB to my website from my system(Ubuntu) request just keeps on stalling. Than somehow i found this command
echo 2 > /proc/sys/net/ipv4/tcp_mtu_probing
and now I am able to upload any file size from my desktop to my website. I don't know what this command does and why is this happening. Please help me identify this problem.I ran
echo 2 > /proc/sys/net/ipv4/tcp_mtu_probing
on my desktop and it worked I haven't changed anything on server. -
Vaibhav Ajay Gupta about 8 yearsthanks for the help. Could you please also help me with why do I need this command in first place whereas I was perfectly able to upload big files before also.
-
Jeff Bencteux about 8 yearsThis could be due to several parameters. There is not one answer to your question. Maybe the default MTU was fine and the route to your server changed and one of the router now drop packets which size are above its MTU instead of fragmenting them because bit DF (don't fragment) is set. You should have a look at your system's settings (
/proc/sys/net/ipv4/
folder to start) and usetraceroute
to know what happens between the two endpoints. -
Vaibhav Ajay Gupta almost 8 yearsthanks for the help. Finally i found one fix don't know how long it will work. There is is a bug in ubuntu 14.04 that set MTU very high in my case approx 9000. I have changed the MTU back to 1200 and now every thing is working fine.