< Home

mtu (Interface view)

Function

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.

Format

mtu mtu

undo mtu

Parameters

Parameter

Description

Value

mtu

Specifies the MTU of an interface.

  • For a physical interface, a VLANIF interface, an Eth-Trunk interface, a physical sub-interface, and an Eth-Trunk sub-interface, the value is an integer that ranges from 128 to 9216, in bytes.
  • For a VE sub-interface, the value is an integer that ranges from 46 to 1500, in bytes.
  • For a VBDIF interface, the value is an integer that ranges from 128 to 1560, in bytes.
  • For a tunnel interface, the value is an integer ranging from 128 to 1530, in bytes.

    For the S5720-EI, S5720-HI, S5730-HI, S5731-H, S5731-S, S5731S-H, S5731S-S, S5732-H, S6720-EI, S6720-HI, S6720S-EI, S6730-H, S6730S-H, S6730-S, and S6730S-S, the value ranges from 128 to 9216. For other switch models, the value ranges from 128 to 1530.

Views

Interface view

Default Level

2: Configuration level

Usage Guidelines

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.

Therefore, a proper MTU is a prerequisite for normal communication on a network.
  • If the configured MTU is excessively small and the packet size is larger, packets are discarded when being forwarded through the forwarding chip; packets are broken into a great number of fragments when being forwarded through the CPU, affecting proper data transmission.
  • If the size of packets exceeds the MTU supported by a transit node or a receiver, the transit node or receiver fragments the packets or even discards them, aggravating the network transmission load.

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.

Example

# 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
Copyright © Huawei Technologies Co., Ltd.
Copyright © Huawei Technologies Co., Ltd.
< Previous topic Next topic >