Using the mtu command, you can set the maximum transmission unit (MTU) of an interface.
Using the undo mtu command, you can restore the default MTU of an interface.
By default, the MTU of an interface is 1500 bytes.
Parameter |
Description |
Value |
---|---|---|
mtu |
Specifies the MTU of an interface. |
|
Usage Scenario
The maximum transmission unit (MTU) determines the maximum number of bytes in IP packets each time a sender can send. The MTU of an IP packet refers to the number of bytes from the IP header of the packet to the data.
The size of data frames is limited at the network layer. Any time the IP layer receives an IP packet to be sent, it checks to which local interface the packet needs to be sent and obtains the MTU configured on the interface. Then the IP layer compares the MTU with the packet length. If the packet length is longer than the MTU, the IP layer fragments the packet into smaller packets, which are shorter than or equal to the MTU. If unfragmentation is configured, some packets may be discarded during data transmission at the IP layer. To ensure jumbo packets are not dropped during transmission, you need to configure forcible fragmentation. In this case, you can run the mtu command to set the size of a fragment.
The default MTU is recommended. When the size of packets to be transmitted or the device that receives packets changes, you can change the MTU based on the actual network.
The configured MTU takes effect for data packets on the forwarding plane.
For S5720-HI, S5730-HI, S5731-H, S6730-H, S6730S-H and S6720-HI, the configured MTU takes effect for data packets on the forwarding plane after you run the ipv4 fragment enable command to enable packet fragmentation. The configured MTU takes effect for GRE packets on the forwarding plane without the need to execute the ipv4 fragment enable command.
For other devices, the configured MTU does not take effect for data packets on the forwarding plane.
Prerequisites
Run undo portswitch command to change the working mode of Ethernet interfaces from Layer 2 mode to Layer 3 mode.
Precautions
After changing the maximum transmission unit (MTU) using the mtu command on an interface, you need to restart the interface to make the new MTU take effect. To restart the interface, run the shutdown command and then the undo shutdown command, or run the restart command in the interface view.
If IPv6 is run on a tunnel interface and the MTU set using the mtu command on the interface is smaller than 1280, IPv6 works abnormally on this interface. To prevent this problem, set the MTU of a tunnel interface to a value greater than or equal to 1280 if IPv6 runs on the tunnel interface.
Configuring the MTU of an interface affects the maximum number of bytes for IP packets to be sent by the interface at a time. This configuration also affects the maximum frame length of sent Ethernet packets. The Ethernet packet size cannot exceed the maximum frame length allowed by the peer interface, which can be set using the jumboframe enable command.
# Set the MTU of GE0/0/1 to 1200 bytes.
<HUAWEI> system-view [HUAWEI] interface gigabitethernet 0/0/1 [HUAWEI-GigabitEthernet0/0/1] undo portswitch [HUAWEI-GigabitEthernet0/0/1] mtu 1200 [HUAWEI-GigabitEthernet0/0/1] restart
# Set the MTU of the VLANIF interface to 1492 bytes.
<HUAWEI> system-view [HUAWEI] interface Vlanif 100 [HUAWEI-Vlanif100] mtu 1492 [HUAWEI-Vlanif100] restart
# Set the MTU of Tunnel 1 to 1492.
<HUAWEI> system-view [HUAWEI] interface tunnel 1 [HUAWEI-Tunnel1] mtu 1492 [HUAWEI-Tunnel1] shutdown [HUAWEI-Tunnel1] undo shutdown