FedoraForum.org - Fedora Support Forums and Community
Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Loopback mtu 16436 ?

    Why does the loopback interface has such a high mtu? I get it that it needs to work out even large packets, which is logical but why this specific number?
    I can set the MTU even higher with the ip link command, so it's not a limitation of the variable used.

  2. #2
    stevea Guest

    Re: Loopback mtu 16436 ?

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

    Code:
    /*
     * 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.

  3. #3
    Join Date
    Aug 2009
    Posts
    11,390
    Mentioned
    98 Post(s)
    Tagged
    0 Thread(s)

    Re: Loopback mtu 16436 ?

    ummm.. 16 * 1024 would be 16384 then if you add the 52 byte TCP/IP header information, it comes out to the 16436 number.

    (52 bytes for the header is.. 20 bytes for the IP header, 20 bytes for the TCP header, then it pads it to the next 32 bit boundary. )


    you can send a 16kb packet along with the header information without fragmenting the packet. That's why that magic number

    Edit: I forgot that it also adds in each option as well, before it pads to the 32 bit boundary
    Last edited by DBelton; 13th October 2010 at 05:55 PM.

  4. #4
    Join Date
    Sep 2010
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Loopback mtu 16436 ?

    Thanks, that number was really bugging me

  5. #5
    stevea Guest

    Re: Loopback mtu 16436 ?

    Yeah - it's just an efficiency thing. Nice to be able to drop a 16k data unit in one "packet".

    Still there is something wrong with your logic. 20bytes for IP + 20 for TCP is already at a 32bit boundary.

    The 802 wrapper is 14B at the top and 4B at the tail, but lo: is NOT an 802 media so these don't exist.

    TCP can take several options described in RFC1323 & 793. It seems the timestamp option is the longest
    at length 10B, but it must be padded to 12B with.'NOP' option bytes. The other PAWS option is only on
    syn or syn/ack packets that are typically very short. I am not aware of any other options.

    Technically it's possible a TCP header would contain multiple options pushing the total header beyond
    52 bytes, but that would be rare enough to ignore, and may require the invention of new options.
    Last edited by stevea; 17th October 2010 at 10:01 PM.

Similar Threads

  1. multiples ip on a nic and loopback
    By jsanza@terra.es in forum Servers & Networking
    Replies: 0
    Last Post: 18th November 2008, 11:24 PM
  2. Multicast loopback
    By paul123 in forum Servers & Networking
    Replies: 12
    Last Post: 18th June 2008, 02:31 AM
  3. loopback not working
    By alexgriz in forum Servers & Networking
    Replies: 1
    Last Post: 17th April 2008, 10:34 PM
  4. loopback issue
    By teethlikelions in forum Using Fedora
    Replies: 7
    Last Post: 20th June 2006, 11:04 AM
  5. Bringing up loopback
    By RaXeT in forum Servers & Networking
    Replies: 0
    Last Post: 8th October 2005, 11:11 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •