Help Center> Bare Metal Server> FAQs> Network and Security FAQ> How Do I Change the MTU Value of a Linux BMS NIC?
Updated on 2022-12-02 GMT+08:00

How Do I Change the MTU Value of a Linux BMS NIC?

Maximum Transmission Unit (MTU) specifies the largest packet of data that can be transmitted on a network and ranges from 1280 to 8888 in the unit of byte. If the MTU values of two hosts are different, the transmission may be interrupted, or packet loss may occur. This section describes how to change the NIC MTU values of BMSs running SUSE Linux, CentOS, and Ubuntu.

SUSE Linux

The following operations use SUSE Enterprise Linux Server 11 SP4 64-bit as an example to describe how to change the MTU value:

  1. Log in to the BMS as user root.
  2. Run the ifconfig command to view the NIC that has a bound IP address, for example, eth0.
  3. Run the following command to open ifcfg-XXX.

    vi /etc/sysconfig/network/ifcfg-XXX

    XXX indicates the NIC obtained in step 2, for example, eth0.

  4. Press i to enter editing mode and add the following statement to set the MTU value of the NIC:

    MTU=8888

  5. Press Esc, enter :wq!, and press Enter to save and exit the file.
  6. Run the following command to restart the network:

    service network restart

  7. Run the ifconfig command to check whether the MTU value has been changed.

CentOS

The following operations use CentOS 7.5 64-bit as an example to describe how to change the MTU value:

  1. Log in to the BMS as user root.
  2. Run the ifconfig command to view the NIC that has a bound IP address, for example, eth0.
  3. Run the following command to open ifcfg-XXX.

    vi /etc/sysconfig/network-scripts/ifcfg-XXX

    XXX indicates the NIC obtained in step 2, for example, eth0.

  4. Press i to enter editing mode and add the following statement to set the MTU value of the NIC:

    MTU=8888

  5. Press Esc, enter :wq!, and press Enter to save and exit the file.
  6. Run the following command to restart the network:

    service network restart

  7. Run the ifconfig command to check whether the MTU value has been changed.

Ubuntu

  1. Log in to the BMS as user root.
  2. Run the following command to open the interfaces file:

    vi /etc/network/interfaces

  3. Press i to enter editing mode and add the following statement to set the MTU value of the NIC:

    post-up /sbin/ifconfig/ eth0 mtu 8888

  4. Press Esc, enter :wq!, and press Enter to save and exit the file.
  5. Run the following command to restart the network:

    /etc/init.d/networking restart

  6. Run the ifconfig command to check whether the MTU value has been changed.

Network and Security FAQ FAQs

more