Skip to content

Instantly share code, notes, and snippets.

@ansmirnov
Created June 22, 2016 07:17
Show Gist options
  • Save ansmirnov/08ed9e942986fe21a0bb21f91b5d6716 to your computer and use it in GitHub Desktop.
Save ansmirnov/08ed9e942986fe21a0bb21f91b5d6716 to your computer and use it in GitHub Desktop.
#!/bin/bash
speedUp=$1
speedDown=$2
# Удаление очередей
/sbin/tc qdisc del dev eth1 ingress
/sbin/tc qdisc del dev eth1 root handle 1:
# Ограничение скорости отдачи
/sbin/tc qdisc add dev eth1 root handle 1: htb default 10 r2q 1
/sbin/tc class add dev eth1 parent 1: classid 1:10 htb rate ${speedUp}kbit quantum 8000 burst 8k
# Ограничение скорости загрузки
/sbin/tc qdisc add dev eth1 handle ffff: ingress
/sbin/tc filter add dev eth1 parent ffff: protocol ip prio 50 u32 match ip src 0.0.0.0/0 police rate ${speedDown}kbit burst 12k drop flowid :1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment