#!/bin/sh ## teste HTB controle de banda rede local master ## # Criando classes e suas respectivos gastos # start () { tc qdisc del dev eth1 root handle 2: htb tc qdisc add dev eth1 root handle 2: htb default 40 tc class add dev eth1 parent 2: classid 2:0 htb rate 102048kbit # definindo classes filhas ## tc class add dev eth1 parent 2: classid 2:10 htb rate 100000kbit ceil 100000kbit tc class add dev eth1 parent 2: classid 2:20 htb rate 1024kbit ceil 1024kbit #tc class add dev eth1 parent 2: classid 2:30 htb rate 300kbit ceil 400kbit tc class add dev eth1 parent 2: classid 2:40 htb rate 1024kbit ceil 1024kbit ## Impedindo que uma conexao "roube" da outra na mesma classe ## tc qdisc add dev eth1 parent 2:10 handle 10: pfifo tc qdisc add dev eth1 parent 2:20 handle 20: sfq perturb 3 tc qdisc add dev eth1 parent 2:30 handle 30: sfq perturb 3 tc qdisc add dev eth1 parent 2:40 handle 40: sfq perturb 3 #teste de ordem dos comandos ## tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 2074 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 3050 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 137 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 138 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 139 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 445 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 2157 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 2154 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 2153 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 3306 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip sport 2210 0xffff flowid 2:10 ## MK's # tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip src 189.16.234.74/28 match ip dst 10.5.11.0/24 flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip src 189.16.234.74/28 match ip dst 10.5.12.0/24 flowid 2:10 ## Trafego para nossos servidores ## tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip src 189.16.234.64/26 match ip dst 192.168.0.0/24 match ip sport 80 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip src 189.16.234.64/26 match ip dst 192.168.0.0/24 match ip sport 443 0xffff flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip src 189.16.234.65/28 match ip dst 192.168.0.0/24 flowid 2:10 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip src 186.192.35.161/29 match ip dst 192.168.0.0/24 flowid 2:10 ## Definindo as conexoes que faram parte de cada classe ## ## VOIP ### tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.23 flowid 2:20 tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.25 flowid 2:20 tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.26 flowid 2:20 tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.27 flowid 2:20 tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.28 flowid 2:20 # diretoria ## tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.3 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.5 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.4 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.21 flowid 2:40 ## geral ## tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.21 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.6 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.9 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.11 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.12 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.13 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.14 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.15 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.16 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.17 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.18 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.19 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.20 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.22 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 2 u32 match ip dst 192.168.0.23 flowid 2:40 tc filter add dev eth1 parent 2:0 protocol ip prio 1 u32 match ip dst 192.168.0.24 flowid 2:40 }