Results 1 to 3 of 3

Thread: Traffic Shaping

  1. #1

    Traffic Shaping

    Hi all!
    I don't really understand the Howto of Traffic Shaping.
    I know what I can do with it, but I don't know how.

    I want to make an up- and downloadlimit for a certain port.
    (upload: <= 1 kb/s / download <= 2 kb/s)

    My connection settings: ppp0 as modem and eth0 for my LAN and then I use iptables!

    Can anyone help me?

    Thx, SiC!

  2. #2

    Re:Traffic Shaping

    Have you read this:

    http://linux.oreillynet.com/pub/a/li...inuxAdmin.html

    I have not tried to do any traffic shaping myself, but this short article seems to make it seem pretty simple.

    As far as I can tell, you will have to configure a virtual device and associate it to your NIC card. Once you have done this, you can set traffic limits on that interface. After that you can either route traffic through that interface by updateing your routing tables, or configure iptables to use that virtual interface in your ruleset. Give it a read and let me know if it clears things up a bit.

  3. #3
    Senior Member
    Join Date
    Sep 2002
    Posts
    421

    Re:Traffic Shaping

    If you just want a hard limit you can use a tbf (toke bucket filter) on your ppp0 interface:

    tc qdisc add dev ppp0 root handle 1: tbf

    The main class: (use a little less than your upload limit):

    tc class add dev ppp0 parent 1:0 classid 1:1 tbf rate 125kbit ceil 125kbit

    The class for the limited port: (I assume there are other classes with priority higher than 3)

    tc class add dev ppp0 parent 1:1 classid 1:10 tbf rate 1kbit ceil 8kbit prio 3

    Now mark the packets with iptables:

    iptables -A POSTROUTING -o ppp0 -p tcp --sport <#> -j MARK --set-mark 10

    and move them into the class defined above:

    tc filter add dev ppp0 parent 1:0 prio 0 protocol ip handle 10 flowid 1:10

    For the downlink it works similarly only you've got to use ingres as the queueing discipline.

Similar Threads

  1. Traffic speed
    By GNEEOT in forum Linux - Hardware, Networking & Security
    Replies: 4
    Last Post: 05-15-2005, 01:18 PM
  2. traffic
    By ammad in forum Linux - Hardware, Networking & Security
    Replies: 1
    Last Post: 01-28-2005, 10:37 PM
  3. Traffic Shaping
    By vvx in forum Linux - Hardware, Networking & Security
    Replies: 1
    Last Post: 03-07-2003, 03:52 PM
  4. bandwidth shaping
    By krinkstar in forum Linux - Hardware, Networking & Security
    Replies: 0
    Last Post: 05-01-2002, 01:35 AM

Bookmarks

Posting Permissions

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