Blame view
templates/gstar/bandwidth_limit.sh
1.16 KB
6a9412d84 fixing ip less th... |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
#!/bin/sh # Traffic shaping script # --------------------------------------------------------------------- # Limits upload/download speed to the lan to 1gbit/s, leaving speeds # outside the LAN unaffected # --------------------------------------------------------------------- # Thanks to iponeverything, fwre01, spr- of http://ubuntuforums.org/ # --------------------------------------------------------------------- # Starting with a clean slate echo Removing any previously set rules... sudo /sbin/tc qdisc del root dev eth0 echo Setting root qdisc... sudo /sbin/tc qdisc add dev eth0 root handle 1: htb echo Setting bandwidth classes... sudo /sbin/tc class add dev eth0 parent 1: classid 1:1 htb rate 1mbit ceil 100gbit sudo /sbin/tc class add dev eth0 parent 1:1 classid 1:10 htb rate 1gbit ceil 1gbit echo Creating filters... sudo /sbin/tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.1.1/24 flowid 1:10 sudo /sbin/tc filter add dev eth0 protocol ip parent 1:0 prio 1 u32 match ip src 192.168.1.1/24 flowid 1:10 echo Finishing... sudo /sbin/tc qdisc add dev eth0 parent 1:10 handle 20: sfq perturb 10 |