最近のコメント

    カテゴリー

    tcによる内向きトラフィックの制御

    tcによる内向きトラフィックの制御

    • outboundなトラフィックの制御は割と簡単に制御できるんだけど、inboundなトラフィックはingressで書いてやってもなかなか思うような制限値になってくれません。
    • そこで、ifb(Intermediate Functional Block device)を使うとよいようです
    • eth0に入ってくるトラフィックを50Mbpsに制限するスクリプト
      #!/bin/sh
      ### traffic shape for inbound eth0
      ## Initialize
      tc qdisc del dev eth0 ingress handle ffff: > /dev/null 2>&1
      tc qdisc del dev ifb0 root handle 1: htb > /dev/null 2>&1
       
      ## ifb setup
      modprobe ifb
      sleep 2
      ip link set dev ifb0 up
       
      ## mirror eth0 to ifb0
      modprobe act_mirred
      sleep 2
      tc qdisc add dev eth0 ingress handle ffff:
      tc filter add dev eth0 parent ffff: protocol ip u32 match u32 0 0 flowid 1:1 action mirred egress redirect dev ifb0
       
      ## traffic shape ifb0
      tc qdisc add dev ifb0 root handle 1: htb default 10
      tc class add dev ifb0 parent 1:1 classid 1:10 htb rate 50mbit

    Leave a Reply

      

      

      

    You can use these HTML tags

    <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>