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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With