Tc: Difference between revisions

From Halfface
Jump to navigation Jump to search
Created page with '==Traffic Control== Linux Advanced Routing & Traffic Control ==limit tcp traffic on port 80== echo “Traffic Control: Removing existing policy…” tc qdisc del dev eth0 r…'
 
 
(One intermediate revision by the same user not shown)
Line 1: Line 1:
==View traffic control==
tc qdisc list
==Traffic Control==
==Traffic Control==


Line 5: Line 8:
==limit tcp traffic on port 80==
==limit tcp traffic on port 80==
  echo “Traffic Control: Removing existing policy…”
  echo “Traffic Control: Removing existing policy…”
  tc qdisc del dev eth0 root
  tc qdisc del dev eth0 root
  echo “Traffic Control: Setting new policy…”
  echo “Traffic Control: Setting new policy…”
  tc qdisc add dev eth0 root handle 2 htb default 1
  tc qdisc add dev eth0 root handle 2 htb default 1
  tc class add dev eth0 parent 2: classid 2:6 htb rate 10000kbit
  tc class add dev eth0 parent 2: classid 2:6 htb rate 10000kbit
  tc class add dev eth0 parent 2:6 classid 2:100d htb rate 7000Kbit
  tc class add dev eth0 parent 2:6 classid 2:100d htb rate 7000Kbit
  tc filter add dev eth0 parent 2: protocol ip pref 4 u32 match ip sport 80 0xffff classid 2:100d
  tc filter add dev eth0 parent 2: protocol ip pref 4 u32 match ip sport 80 0xffff classid 2:100d

Latest revision as of 15:24, 13 June 2012

View traffic control

tc qdisc list

Traffic Control

Linux Advanced Routing & Traffic Control

limit tcp traffic on port 80

echo “Traffic Control: Removing existing policy…”
tc qdisc del dev eth0 root
echo “Traffic Control: Setting new policy…”
tc qdisc add dev eth0 root handle 2 htb default 1
tc class add dev eth0 parent 2: classid 2:6 htb rate 10000kbit
tc class add dev eth0 parent 2:6 classid 2:100d htb rate 7000Kbit
tc filter add dev eth0 parent 2: protocol ip pref 4 u32 match ip sport 80 0xffff classid 2:100d