In Alibaba Cloud Linux, a dummy interface is a virtual interface that behaves like a real network interface for testing purposes. A dummy interface provides a device to route packets through without actually transmitting the packets. This topic describes how to create a dummy interface in Alibaba Cloud Linux 2 and 3 and configure a maximum transmission unit (MTU) for the interface.
Create a dummy interface in Alibaba Cloud Linux 3
In Alibaba Cloud Linux 3, NetworkManager works as the network service and does not allow you to create dummy interfaces by using ifcfg-* files. To create dummy interfaces in Alibaba Cloud Linux 3, run nmcli commands or modify configuration files.
Create a dummy interface by running an nmcli command
dummy0: the name of the dummy interface. Specify a name for the dummy interface based on your business requirements.
sudo nmcli connection add con-name dummy0 type dummy ifname dummy0Configure an MTU for the dummy interface
Run an nmcli command to configure an MTU
Run the following command to configure an MTU.
Replace
[$mtu]with a desired MTU value. The valid MTU values vary based on the network interface type and the driver. The default MTU value is 1500.sudo nmcli c modify dummy0 802-3-ethernet.mtu [$mtu]Run the following command to restart NetworkManager:
sudo systemctl restart NetworkManagerRun the following commands to reconnect to the
dummy0interface to make the configurations take effect:sudo nmcli c down dummy0 sudo nmcli c up dummy0Run the following command to view the MTU value of the dummy interface:
ip link show dummy0
Modify the dummy0.nmconnection configuration file to configure an MTU
Run the following command to create the
dummy0device and thedummy0connection:sudo nmcli connection add con-name dummy0 type dummy ifname dummy0Run the following commands to view the created
dummy0connection anddummy0device:nmcli c nmcli dRun the following command to open the
dummy0.nmconnectionfile:sudo vim /etc/NetworkManager/system-connections/dummy0.nmconnectionPress the
Ikey to enter Insert mode and add themtuparameter or change the value of the parameter.Replace
[$mtu]with a desired MTU value. The valid MTU values vary based on the network interface type and the driver. The default MTU value is 1500.[ethernet] mtu=[$mtu]Press the
Esckey, enter:wq, and then press theEnterkey to save and close the file.Run the following command to restart NetworkManager:
sudo systemctl restart NetworkManagerRun the following commands to reconnect to the
dummy0interface to make the configurations take effect:sudo nmcli c down dummy0 sudo nmcli c up dummy0Run the following command to view the MTU value of the dummy interface:
ip link show dummy0
Create a dummy interface in Alibaba Cloud Linux 2
Create a dummy interface
dummy0: the name of the dummy interface. Specify a name for the dummy interface based on your business requirements.
sudo ip link add dummy0 type dummyAfter you create the dummy interface, the following message appears. Ignore the message.

Configure an MTU for the dummy interface
Run the following command to create and open the
ifcfg-dummy0file:sudo vim /etc/sysconfig/network-scripts/ifcfg-dummy0Press the
Ikey to enter Insert mode and copy the following content to theifcfg-dummy0file:Replace
[$mtu]with a desired MTU value. The valid MTU values vary based on the network interface type and the driver. The default MTU value is 1500.DEVICE="dummy0" BOOTPROTO="static" TYPE="Ethernet" ONBOOT="yes" PEERDNS="no" MTU=[$mtu]Press the
Esckey, enter:wq, and then press theEnterkey to save and close the file.Run the following command to restart the
networkservice to make the configurations take effect:sudo systemctl restart networkRun the following command to view the
dummy0device and the MTU value of the device:ip link show dummy0