Posts Tagged ‘shaping’

Shaping in Slackware

Thursday, January 17th, 2013

An ‘iproute2’ package (description) must be installed. Let’s imagine that we use a default kernel in which ‘everything is included but the kitchen sink’. :)

FIRST. Create /etc/rc.d/rc.shaper with the following code:


#!/bin/bash
shaper_start() {
tc qdisc add dev eth1 root handle 1:0 htb default 254

tc class add dev eth1 parent 1:0 classid 1:1 htb rate 0.5mbit
tc class add dev eth1 parent 1:0 classid 1:2 htb rate 3.3mbit
tc class add dev eth1 parent 1:0 classid 1:254 htb rate 256kbit

tc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.0.2 flowid 1:1
tc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.0.3 flowid 1:2
}

shaper_stop() {
tc qdisc del dev eth1 root
}
shaper_restart() {
shaper_stop
sleep 1
shaper_start
}

case "$1" in
'start')
shaper_start
;;
'stop')
shaper_stop
;;
'restart')
shaper_restart
;;
*)
echo "usage $0 start|stop|restart"

SECOND. Make it executable: chmod +x /etc/rc.d/rc.shaper

THIRD. Add to /etc/rc.d/rc.inet2 these lines:


if [ -x /etc/rc.d/rc.shaper ]; then
/etc/rc.d/rc.shaper start
fi

Now type /etc/rc.d/rc.shaper start. After that your client with 192.168.0.2 IP address will have a 0.5 mbit/s bandwidth and 192.168.0.3 one will have 3.3 mbit/s. Any other IPs will have 256 kbit/s only, as it is set in the default shaping rule.

OpenBSD. Ограничение потока в ALTQ 4 гбит/с

Wednesday, July 4th, 2012

Вряд ли конечно придется попробовать ALTQ на 10-гигабитных интерфейсах, но тем не менее не стоит забывать:

ALTQ using hfsc is limited to a maximum parent bandwidth of 4294Mb.
This value is 2^32 or 4,294,967,296 bits. If you set the bandwidth any
higher, altq will flip back to zero. This “bug” was found when trying
to test 10 gigabit and 40 gigabit bandwidth models. These tests were
done on OpenBSD 32bit and 64bit as well as FreeBSD 32bit and 64bit.

http://lists.freebsd.org/pipermail/freebsd-pf/2011-July/006203.html