You may experience the problem with too high a
MTU value. In such case, small packages (like
ICMP ECHO or
TCP SYN) are working correctly so you can ping other hosts, and TCP sessions are opened but as soon as you try to transfer bigger packages, it stops working.
This issue is quite hard to diagnose and the easiest way to test this is to set
MTU to some smaller number, like 1400. You can do this using
ip command from
sudo ip link set mtu 1400 dev eth0
ifconfig eth0 mtu 1400
Both command do exactly the same - they set
MTU value to
1400. You may experiment with higher values (up to default
1500) to find the biggest one that works. It will probably be
MTU stands for
Maximum Transmission Unit - it's a size of the largest packet that the network can handle. By default it is
1500 for Ethernet v2 (practically all the Ethernet networks today). If you try to send larger packet, the network will drop it.
This means that your network card need to know what is the
MTU value of the network so that it wont send packages that are too large. If you are transferring some bigger amount of data, network stack will organize it in the largest packages possible to reduce the number of packages that has to be send (in order to reduce overhead).
ping command wont help you diagnose the problem since default packages sent by this command are couple 84 bytes large (so they will work as long as MTU of your network is at least 84).
Now, why default
1500 value may be wrong? If your network uses
PPPoE, according to
RFC 1042, the
MTU should be 1492. One other situation where I had to lower MTU value was using
IEEE 802.1Q VLAN tagging. In such situation each packet will be amended by adding 4 bytes so if your packet already has
1500 bytes, it will be enlarged to
MTU value has direct impact on network performance. The bigger the value is, the more data can be transferred in one network package. Since each network package has to be processed individually and much of this work is not depended on it's size (processing headers and making decisions based on them), a lot of network equipment has limits not only on bandwidth but also on number of packages per second. This means that making packages bigger makes network working faster.
There are some problems with big packages, though. If you have bigger package, chances that it will be corrupted are greater. Since the only way to handle damaged packages on Ethernet is to drop them, big packages may degrade network performance when there are some transfer problems. In addition, some connections may not be able to transport packages over a certain size, which will result in fragmentation.
That being said, reducing MTU size by a few bytes should have only marginal impact on your network performance. This should be even less visible on RaspberryPi since it's not a high performance network device.