You are not logged in.

#1 2012-05-06 04:43:53

Gullible Jones
Registered: 2004-12-29
Posts: 4,863

Significance of loopback MTU

So the default MTU for the loopback interface is 16 KB. And apparently this is in fact changeable, or at least ifconfig acts as though it is.

Is there any situation where changing the MTU of the loopback interface might be useful? e.g. could tuning it up or down affect the performance of a local proxy? I'm just kind of curious about why this setting exists.


#2 2012-05-06 23:41:43

Forum Moderator
Registered: 2007-09-28
Posts: 5,503

Re: Significance of loopback MTU

You piqued my interest, but this is all I could find on a quick Google... Seems to be since the loopback interface doesn't connect to an ethernet network, there are no packets or fragmentation limits, in which case I guess it depends on the available buffers or whatever the kernel uses internally to transfer the "packets" as to what the optimum size would be.

(Warning: I don't know enough about the kernel to stand by anything I've said in the above paragraph tongue) wrote:

From linux-2.6-stable/drivers/net/loopback.c

 * The loopback device is special. There is only one instance
 * per network namespace.
static void loopback_setup(struct net_device *dev)
        dev->mtu                = (16 * 1024) + 20 + 20 + 12;
        dev->hard_header_len    = ETH_HLEN;     /* 14   */
        dev->addr_len           = ETH_ALEN;     /* 6    */
        dev->tx_queue_len       = 0;
        dev->type               = ARPHRD_LOOPBACK;      /* 0x0001*/
        dev->flags              = IFF_LOOPBACK;
        dev->priv_flags        &= ~IFF_XMIT_DST_RELEASE;
        dev->features           = NETIF_F_SG | NETIF_F_FRAGLIST
                | NETIF_F_TSO
                | NETIF_F_NO_CSUM
                | NETIF_F_HIGHDMA
                | NETIF_F_LLTX
                | NETIF_F_NETNS_LOCAL;
        dev->ethtool_ops        = &loopback_ethtool_ops;
        dev->header_ops         = &eth_header_ops;
        dev->netdev_ops         = &loopback_ops;
        dev->destructor         = loopback_dev_free;

16436 = = (16 * 1024) + 20 + 20 + 12

Remember that the lo device is not an 802 media - so there is no MAC address and encapsulation. The flags above indicate there is no checksum. I suppose the extra 52 bytes are sufficient to create the IP header with a 16KiB paymoad.

Also: wrote:

In the example above the loopback device has had its MTU set to 16436 from 16430. If we echo 1 to ‘/proc/sys/net/ipv4/ip_no_pmtu_disc’ then MTU dynamic shaping will be turned off and the machine will not send data packets less than the maximum if it has data to fill it. This is some times useful when trying to simulate devices on a network that do not have dynamic MTU built in or disabled.


Board footer

Powered by FluxBB