hi all, i have a question. i spent some time reading about TCP Window Size , Maximum Segment Size (MSS) and Maximum Transmission Unit (MTU). Let's assume that the receiver window size is 16,384 bytes which means that the sender can send up to 16,384 bytes before stopping to wait for an acknowledgement. Let's also assume that the maximum segment size is 1024. This means that the sender can send 1024 bytes 16 times before it will stop sending and wait for an acknowledgement. So when A is the sender and B is the receiver we will always look and take into count the values provided from host B, right ? i mean it's WS and MSS ? one more thing , while reading about MTU i came across this : http://kb.linksys.com/Linksys/GetArticle.aspx?docid=fbf8e8564632422eaa8ea80bf9dcba64_386.xml setting up the correct MTU size. on my router it was configured by default 1500 bytes i followed the steps and it looks like fragmentation would stop to occur at 1470 bytes . would this really make such a big difference in performance when i change it to 1470 bytes ? also does it often happen that because the MMS is bigger then the MTU that fragmentation occurs ? thank you in advance for all of your answers regards Adam asked 11 Mar '15, 14:30 adasko |
2 Answers:
Yes. The sender has to always pay attention to the window size of the receiver, because it cannot send more than that without acknowledgement - otherwise, the receiver will most likely discard further segments if the window size is exceeded. The MSS is something where it makes sense for the sender not to exceed the value of the receiver, because it must assume that larger segments are not going to get through. It is wise to try to avoid fragmentation, because it puts additional load on the systems involved, so if you know that the MTU of 1500 is too big you should reduce it until fragmentation is not an issue anymore. Reducing the MTU will lower the efficiency, but it will probably hurt more if packets have to be fragmented. MSS can never be bigger than the MTU (it's actually at least 40 bytes less, 20 bytes for the TCP header, 20 bytes for the IPv4 header). That's because if you reduce MTU, MSS is automatically reduced as well. answered 11 Mar '15, 14:46 Jasper ♦♦ |
When A is sending, it takes into account the last seen WS from B and visa versa. MSS is a different story. It is deducted from the local interface that is used for sending the data. However, it can be changed by using the TCP option to set the MSS. In that case it uses the MSS as it has been received. Please note that any hop in between B and A can change the value of the MSS option to prevent fragmentation taking place later on. Consider a network where there is an IPsec tunnel somewhere in the middle. And let's assume the IPsec headers take 50 extra bytes. If B sends a MSS of 1460 (based on its ethernet interface), the VPN router can lower this to 1410. So when A sends TCP segments of 1410, it will be 1450 bytes on the network and the IPsec headers can still be added without the need to fragment the packet. Then MTU is always just a local thing of the data link layer. This means between A and B there can be mediums with larger MTU sizes and also mediums with lower MTU values. There might not be a big performance hit when fragmentation occurs. However, some devices don't work really well with fragmentation. For instance, some firewalls by default won't pass fragmented traffic. If a frame is too big to forward on the next link, because the MTU of the next link is smaller than the packet size, then fragmentation occurs. A router never segments traffic at the TCP layer, it is only aware of the IP datagram and will split it up if necessary to forward it towards the destination. answered 11 Mar '15, 14:48 SYN-bit ♦♦ |
So MSS is determined during the initial handshake? now im confused... So each hope will change the MSS? Not fragment the packet? where do we get the MSS value from? Is it the NIC's driver? How is MSS able to prevent fragmentation? so if we now that data needs to go outside our LAN it will takeq thew MSS fromq the router?
Yes, MSS is determined in the handshake. Both nodes see what the other MSS is, and usually both use the lower value.
Each hop can change the MSS, not will. Some devices do it because they know the MTU is too small for the MSS seen in the packet. MSS is usually derived from the MTU. The NIC driver knows the MTU of the medium, and MSS is calculated from it.
i see. so both MS and MSS are defined on the Transport Layer, right ? and MMS is the number of bytes that can be send at a time ? so this determines how big a single packet will on the Network Layer, yes ? if yes, i'm a bit confused because i red that the MTU is determined by the Data Link Layer and the value is then past over to the Network Layer... so for me to get it right. transport layer says the MSS is xyz so in the network layer packets are created with this size but then while moving them to Layer 2 it sees that the link will not be able to handle this size of packets and asks to fragment them (so fragmentation will occur on Layer 3 , yes? )
thank's for any response