ADSL Bandwidth Management HOWTO by Dan Singletary (inspirational books for students TXT) π
-----
3.5. Attempting to Throttle Inbound Traffic
By using the Intermediate Queuing Device (IMQ), we can run all incoming packets through a queue in the same way that we queue outbound packets. Packet priority is much simpler in this case. Since we can only (attempt to) control inbound TCP traffic, we'll put all non-TCP traffic in the 0x00 class, and all TCP traffic in the 0x01 class. We'll also place "small" TCP packets in the 0x00 class since these are most likely ACK packets for outbound data that has already been sent. We'll set up a standard FIFO queue on the 0x00 class, and we'll set up a Random Early Drop (RED) queue on the 0x01 class. RED is better than a FIFO (tail-drop) queue at controlling TCP because it will drop packets before the queue overflows in an attempt to slow down transfers that look like they're about to get out of control. We'll also rate-limit bot
Read free book Β«ADSL Bandwidth Management HOWTO by Dan Singletary (inspirational books for students TXT) πΒ» - read online or download for free at americanlibrarybooks.com
- Author: Dan Singletary
- Performer: -
Read book online Β«ADSL Bandwidth Management HOWTO by Dan Singletary (inspirational books for students TXT) πΒ». Author - Dan Singletary
iptables -t mangle -F MYSHAPER-OUT 2> /dev/null > /dev/null
iptables -t mangle -X MYSHAPER-OUT 2> /dev/null > /dev/null
iptables -t mangle -D PREROUTING -i $DEV -j MYSHAPER-IN 2> /dev/null > /dev/null
iptables -t mangle -F MYSHAPER-IN 2> /dev/null > /dev/null
iptables -t mangle -X MYSHAPER-IN 2> /dev/null > /dev/null
ip link set imq0 down 2> /dev/null > /dev/null
rmmod imq 2> /dev/null > /dev/null
if [ "$1" = "stop" ]
then
echo "Shaping removed on $DEV." exitfi
##################################################### Outbound Shaping (limits total bandwidth to RATEUP) set queue size to give latency of about 2 seconds on low-prio packetsip link set dev $DEV qlen 30
changes mtu on the outbound device. Lowering the mtu will result in lower latency but will also cause slightly lower throughput due to IP and TCP protocol overhead.ip link set dev $DEV mtu 1000
add HTB root qdisctc qdisc add dev $DEV root handle 1: htb default 26
add main rate limit classestc class add dev $DEV parent 1: classid 1:1 htb rate ${RATEUP}kbit
add leaf classes - We grant each class at LEAST it's "fair share" of bandwidth. this way no class will ever be starved by another class. Each class is also permitted to consume all of the available bandwidth if no other classes are in use.tc class add dev $DEV parent 1:1 classid 1:20 htb rate $[$RATEUP/7]kbit ceil ${RATEUP}kbit prio 0
tc class add dev $DEV parent 1:1 classid 1:21 htb rate $[$RATEUP/7]kbit ceil ${RATEUP}kbit prio 1
tc class add dev $DEV parent 1:1 classid 1:22 htb rate $[$RATEUP/7]kbit ceil ${RATEUP}kbit prio 2
tc class add dev $DEV parent 1:1 classid 1:23 htb rate $[$RATEUP/7]kbit ceil ${RATEUP}kbit prio 3
tc class add dev $DEV parent 1:1 classid 1:24 htb rate $[$RATEUP/7]kbit ceil ${RATEUP}kbit prio 4
Comments (0)