When are 'egress' traffic shaping rules applied?

Discussion in 'Linux Networking' started by spip_yeah, Nov 29, 2006.

  1. spip_yeah

    spip_yeah Guest


    I understand that shaping occurs on egress. However, what does it mean
    exactly to leave an interface? Is it when a packet actually exits an
    interface to be transmitted? Or does it also mean when a packet exits
    one interface to be transmitted over another?

    If we have a linux router with two interfaces, eth0 and eth1. And
    packet arrives on eth1 that needs to be routed to eth0. From eth0 it is
    transmitted. The packet is NOT considered to have left the eth1
    interface, but only the eth0 interface, correct? Therefore, if there
    are shaping rules on both eth0 and eth1, only the ones for eth0 will be
    applied, correct?

    Thank you.
    spip_yeah, Nov 29, 2006
    1. Advertisements

  2. spip_yeah

    buck Guest

    No, that is not correct.

    A packet deques when the shaper decides to do that, and the shaper
    has no clue - and does not care about - where that packet is going.
    So if a packet gets sent from eth1 to eth0, the egress shaping on eth1
    decides when it goes to eth0 and the egress shaping on eth0 decides
    when it gets sent to the internet.

    When the buffer for eth1 fills up, the packets destined for eth0 will
    be dropped.
    buck, Nov 30, 2006
    1. Advertisements

  3. spip_yeah

    spip_yeah Guest

    No, that is not correct.
    Ok, so shaping is applied when a packet is dequeued.

    So there's something I don't understand, and the only way to explain it
    would be that a packet never gets dequeued from one device to get
    enqueued on another device, but I would like to confirm. In my example
    I will refer to my use of netem, but this is not really netem specific,
    only it's easy the see the results.

    So if I again take my case of a linux router having 2 interfaces, eth0
    and eth1. net0 is the network interfaced via eth0, and net1 is the
    network interfaced via eth1.

    I am setting a netem delay rule of 100 ms on eth1. Then a host from
    net0 pings a host from net1. The ping is 100ms longer than without the
    rule. This tells me that the packet has been dequeued only once, since
    the 100 ms delay has only been applied once. This in turn tells me a
    packet gets enqueued only for one device when going through a router.

    So if we forget the round trip for now, and knowing that when a packet
    goes through a router by entering from one interface and leaving from
    another interface it apparently only gets queued once, which interface
    does the packet get queued for? For the example, assuming a host on
    net0 sends a packet to a host on net1, does the packet get enqueued,
    and later dequeued, on eth0 or eth1?

    Thank you.
    spip_yeah, Dec 1, 2006
  4. spip_yeah

    Andy Furniss Guest

    Yes, ingress traffic does not hit the egress shaper on the nic it came
    in on.

    If you want to shape ingress you have to use ifb (recent 2.6s), you can
    also police traffic on ingress.

    Andy Furniss, Dec 1, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.