MTU of IPV4 and IPV6

Source: Internet
Author: User

Maximum Transmission Unit (MTU) refers to the Maximum data packet size (in bytes) that can be passed over a layer of a communication protocol ). The maximum transmission unit parameter is usually related to the communication interface (network interface card, serial port, etc ). The Internet Protocol allows IP sharding so that data packets can be divided into small fragments to pass through links with the maximum transmission unit smaller than the original size of the data packet. This fragment process occurs at the network layer (the third layer of the OSI model). The fourth layer is the transport layer, and the transport layer is the most important layer in the OSI model. Here, transmission is controlled according to the window, instead of MTU. The transmission protocol simultaneously controls traffic or specifies an appropriate sending rate based on the speed at which the recipient can receive data. In addition, the transport layer forcibly splits long data packets according to the maximum size that can be processed by the network. For example, Ethernet cannot receive packets larger than 1500 bytes. The transmission layer of the sender node divides the data into smaller data slices, and arranges a serial number for each data segment so that the data can reach the transmission layer of the receiver node, the process can be reorganized in the correct order, which is called sorting. It uses the maximum transmission unit value that sends a group to the network interface on the link. All parts of the original group are marked, so that the TCP layer of the target host can regroup the original data packet. In Internet protocols, the "maximum transmission unit of a path" of an Internet transmission path is defined as the minimum value of the maximum transmission unit for all IP addresses on the "path" from the source address to the destination address. Or, from another perspective, the maximum number of transmission units that can pass through this "path" without further sharding. RFC 1191 describes the path maximum transmission unit discovery method, which is a technology used to determine the maximum transmission unit of a path between two IP hosts. It aims to avoid IP fragmentation. In this technology, the source address uses the location bit of the datagram DF (Don't Fragment, Don't shard, then, the size of the sent datagram is gradually increased. Any device in the path that needs to partition the group will discard the datagram and return an ICMP response with a "too large datagram" to the source address, the source host "learns" to the maximum transmission unit through this path without sharding. Unfortunately, more and more networks Block ICMP transmission (for example, in order to prevent DDOS attacks)-This makes the Discovery Method of the maximum transmission unit of the path unable to work normally, A common manifestation is that a connection can work normally when the data traffic is low, but once a large amount of data is sent at the same time, it will be immediately suspended (for example, when using IRC, the customer will find that no response is received after sending a ping to prohibit IP spoofing, because the connection is blocked by a large number of welcome messages ). Moreover, in a network that uses the Internet protocol, the "path" from the source address to the destination address often responds to various events (such as server Load balancer, congestion, and power failure) it is dynamically modified, which may cause the maximum transmission unit of the path to change during transmission, sometimes even repeatedly. As a result, when the host finds a new maximum transmission unit that can work securely, more groups are lost. For most local networks that use Ethernet nowadays, the maximum transmission unit value is 1500 bytes. However, a system like PPPoE reduces this value, which may result in the use of the maximum transmission unit discovery method: some sites become inaccessible after the firewall is improperly configured. In this case, you may find a work ing method, but it depends on which part of the network you control. These methods include modifying the MSS (Maximum Segment Size, Maximum Segment Size) of the first group used to establish a TCP connection at one end of the firewall ). For some IBM systems (such as XSeries) that support earlier versions of the Ethernet protocol, it is possible to operate on common LAN only after the maximum transmission unit is set to 1492. How to check whether the MTU of the gateway opens the dos window on the local machine and execute: ping-f-l 1472 192.168.0.1 where 192.168.0.1 is the gateway IP address and 1472 is the length of the packet. Note that the preceding parameter is "-l" (lower-case L), rather than "-1 ". If the packet can be pinged, it means that the packet does not need to be split and can be sent out through the gateway. If Packet needs to be fragmented but DF set appears, the Packet needs to be split and sent. In this case, reduce the packet length and then execute the ping command above. Try the packet length several times from 1400 to 1472. Add the packet length to the packet header by 28 bytes to obtain the MTU value. If the MTU value of the gateway is 1500, no modification is required. If the gateway cannot be pinged through a firewall, set MTU to 1400. How to modify the MTU of the local machine is as follows: on Windows platforms 1. Run regedit2. Enable: HKEY_LOCAL_MACHINE \ SYSTEM \ CurrentControlSet \ Services \ Tcpip \ Parameters \ Interfaces3 and Interfaces, each sub-item corresponds to a nic. Select the NIC as follows: A. Determine the NIC used by the local machine to connect to the Internet or the IP address of the dial-up connection, for example, 192.168.0.19; B. Click the subitem on Interfaces with the mouse, view IPAddress items in the key value list. C. If the key value of IPAddress is the same as that of IP address A, that is, 192.168.0.19, this subitem is the network card to be found. 4. Enter this subitem, right-click in the window on the right, select "new"-> "DWORD Value", enter the name "MTU", and press Enter. Double-click "MTU" and the modification window will pop up. Fill in the MTU value (generally 1480 in decimal format ). Set the base number to decimal. After the configuration, You need to restart the machine to make it take effect. Windows 7 (XP, Vista not tested) 1. Run cmd2 with administrator privileges, use the netsh interface ipv4 show subinterfaces command to see MTU and local connection name. 3. use netsh interface ipv4 set subinterface "Local Connection" mtu = 1000 store = persistent (note: the connection name here is the connection name corresponding to the MTU value shown in the above command, it is displayed on the right .) Appendix: 1. This method does not need to be restarted; 2. If ipv6 is used, change ipv4 to ipv6Linux. You can use the following command to modify the value of the ifconfig Nic MTU with the root permission. For example, ifconfig eth0 mtu 1460MaxMTU is the largest TCP/IP transmission unit, in TCP/IP, data to be transmitted is divided into smaller groups for transmission. The size of each group is 576 bytes. In Windows, the default byte is 1500, which is the Ethernet grouping standard. The PPPoE used by ADSL is slightly smaller than this value, generally 1492. Some websites use MaxMTU greater than 1492. Therefore, some webpages may be inaccessible. Modifying the default MaxMTU in Windows can solve this problem. This problem may be encountered in the use of PPPoE software installed on PCs or PPPoE software built in Modem. If you use a vro, change MTU to manual in firewall configuration => Basic settings and set it to 1492. then, how can we determine that the MTU obtained from the ISP is 1500? See the position circled in the attachment. the default value of some common link layer protocols MTU in the network is as follows: FDDI protocol:4352 bytesEthernet protocol:1500 bytesPPPoE (ADSL) protocol:1492 bytesX.25 protocol (Dial Up/Modem ):576 bytesPoint-to-Point:4470 bytesIf the IP layer needs to transmit a datagram larger than the MTU of the link layer, the IP layer will split the datagram. A datagram is divided into several parts. The size of each part is smaller than or equal to the MTU value of the link layer. When hosts on the same network communicate with each other, the MTU of the network is very important to both parties. However, when a host can communicate through many networks, the most important thing for both parties is the minimum MTU in the communication path, because the MTU at the link layer of different networks on the communication path is different. The smallest MTU in the communication path is called the path MTU. ------------------------
The ipv6 mtu of interface 0 is 3100:
Awang @ awangdevpc:/tmp $ sudo tcpdump-ni eth0-evvv icmp6

09:22:22. 394905 f0: de: f1: fb: 98: 8b> 00: 21: 27: ac: f1: 53, ethertype IPv6 (0x86dd), length 3110: (hlim 64, next-header Fragment (44) payload length: 3056) 1234: 60ef: 4cde: b1a1: d87e> 1234: 2: frag (0xe5fc7cc4: 0 | 3048) ICMP6, echo request, length 3048, seq 1
09:22:22. 394934 f0: de: f1: fb: 98: 8b> 00: 21: 27: ac: f1: 53, ethertype IPv6 (0x86dd), length 2022: (hlim 64, next-header Fragment (44) payload length: 1968) 1234: 60ef: 4cde: b1a1: d87e> 1234: 2: frag (0xe5fc7cc4: 3048 | 1960)

09:22:22. 396538 00: 21: 27: ac: f1: 53> f0: de: f1: fb: 98: 8b, ethertype IPv6 (0x86dd), length 3110: (hlim 64, next-header Fragment (44) payload length: 3056) 1234: 2> 1234: 60ef: 4cde: b1a1: d87e: frag (0x249da4f6: 0 | 3048) ICMP6, echo reply, length 3048, seq 1
09:22:22. 396544 00: 21: 27: ac: f1: 53> f0: de: f1: fb: 98: 8b, ethertype IPv6 (0x86dd), length 2022: (hlim 64, next-header Fragment (44) payload length: 1968) 1234: 2> 1234: 60ef: 4cde: b1a1: d87e: frag (0x249da4f6: 3048 | 1960)



1. Algorithm:

1> Is the biggest integer which is smaller than 3100.
2> cocould be devided by 8.
Since "3096" match the rule, so use it in IP layer to fragment.

2. Then use the "3096" to caculate other length:
3> Ethernet layer length: add the ethernet header length "14", the total length which is printed in ethernet layer is "3110 ".
4> IP layber payload: Since the IP layber of IPV4 is 40, so the printed payload is 3056.
5> ICMP length: And the ICMP tyoe of IPV6 is 8, so the printed ICMP payload is 3048.

------------------------------------------------------
Ipv4 mtu:

If set the ipv4 mtu of interface 0 to "1500", then ping an IP address whihc is directlly connected, then use tcpdump:


Awang @ awangdevpc:/tmp $ sudo tcpdump-ni eth0-evvv icmp

09:39:53. 721760 00: 21: 9b: 58: ca: 8f> 00: 90: 7f: 95: 70: 98, ethertype IPv4 (0x0800), length 1514: (tos 0x0, ttl 64, id 8113, offset 0, flags [+], proto ICMP (1), length 1500)
172.26.0.183> 172.26.0.1: ICMP echo request, id 4321, seq 1, length 1480
09:39:53. 721778 00: 21: 9b: 58: ca: 8f> 00: 90: 7f: 95: 70: 98, ethertype IPv4 (0x0800), length 1514: (tos 0x0, ttl 64, id 8113, offset 1480, flags [+], proto ICMP (1), length 1500)
172.26.0.183> 172.26.0.1: icmp
09:39:53. 721781 00: 21: 9b: 58: ca: 8f> 00: 90: 7f: 95: 70: 98, ethertype IPv4 (0x0800), length 1514: (tos 0x0, ttl 64, id 8113, offset 2960, flags [+], proto ICMP (1), length 1500)
172.26.0.183> 172.26.0.1: icmp
09:39:53. 721784 00: 21: 9b: 58: ca: 8f> 00: 90: 7f: 95: 70: 98, ethertype IPv4 (0x0800), length 602: (tos 0x0, ttl 64, id 8113, offset 4440, flags [none], proto ICMP (1), length 588)
172.26.0.183> 172.26.0.1: icmp

09:39:53. 722909 00: 90: 7f: 95: 70: 98> 00: 21: 9b: 58: ca: 8f, ethertype IPv4 (0x0800), length 1514: (tos 0x0, ttl 64, id 10621, offset 0, flags [+], proto ICMP (1), length 1500)
172.26.0.1> 172.26.0.183: ICMP echo reply, id 4321, seq 1, length 1480
09:39:53. 723153 00: 90: 7f: 95: 70: 98> 00: 21: 9b: 58: ca: 8f, ethertype IPv4 (0x0800), length 1514: (tos 0x0, ttl 64, id 10621, offset 1480, flags [+], proto ICMP (1), length 1500)
172.26.0.1> 172.26.0.183: icmp
09:39:53. 723161 00: 90: 7f: 95: 70: 98> 00: 21: 9b: 58: ca: 8f, ethertype IPv4 (0x0800), length 1514: (tos 0x0, ttl 64, id 10621, offset 2960, flags [+], proto ICMP (1), length 1500)
172.26.0.1> 172.26.0.183: icmp
09:39:53. 723402 00: 90: 7f: 95: 70: 98> 00: 21: 9b: 58: ca: 8f, ethertype IPv4 (0x0800), length 602: (tos 0x0, ttl 64, id 10621, offset 4440, flags [none], proto ICMP (1), length 588)
172.26.0.1> 172.26.0.183: icmp

1. Algorithm:
1> Is the biggest integer which is smaller than 1500.
2> cocould be devided by 4.
Since "1500" match the rule, so use it in IP layer to fragment.

2. Then use the "3096" to caculate other length:
Ethernet layer length: Add the ethernet header length "14", the total length which is printed in ethernet layer is "1514 ".

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.