Differences

This shows you the differences between two versions of the page.

Link to this comparison view

saisp:labs:11:contents:06 [2014/05/18 12:34]
mihai.carabas [06. Colectare statistici folosind ''tc'']
saisp:labs:11:contents:06 [2014/05/18 14:27] (current)
mihai.carabas
Line 1: Line 1:
-==== 06. Colectare statistici folosind ''​tc'' ​====+==== 06. [15p] Politici de limitare per client ​====
  
-Pe lângă controlul traficului, utilitarul ''​tc''​ ne furnizează șstatistici despre traficul transferat de fiecare clasă:<code bash> +Ștergețqdisc-ul root adăugat anterior.
-root@gateway:​~#​ tc -s class show dev eth0 +
-</​code>​+
  
-Scrieți un script care extrage numărul de octeți trimiși pentru una din claseUtilizați acest script ​să generați un grafic folosind informațiile prezentate în [[saisp:labs:03:​contents:​05|]].+Realizați configurațiile necesare astfel încât să limitați stația ''​client1''​ la 5 mbps, iar stația ''​client2''​ la 3mbpsÎn plus dorim ca cei 3mbps ai stației ''​client2'' ​să fie împărțiți după cum urmează: 
 +  * 1mbps pentru traficul ce ajunge pe portul 1111 (Hintfolosiți 2 reguli de ''​match''​ ale clasificatorului ''​u32''​) 
 +  * 2mbps pentru traficul de pe restul porturilor 
 + 
 +Testați folosind ''​iperf''​.
  
 <​solution -hidden> <​solution -hidden>
 <code bash> <code bash>
-root@gateway:​~#​ tc -s class show dev eth0 | grep -A 4 "​class ​htb 1:1"|grep Sent|cut -d " " -f3 +root@gateway:​~#​ tc qdisc del dev eth0 root 
-6375340+root@gateway:​~#​ tc qdisc add dev eth0 root handle 1: htb 
 +root@gateway:​~#​ tc class add dev eth0 parent ​1: classid ​1:1 htb rate 5mbit burst 128k
  
-Se adaugă comanda de mai sus în scriptul din [[saisp:labs:03:contents:05|]], la variabila ''​outOctets''​+root@gateway:~# tc class add dev eth0 parent 1classid 1:2 htb rate 3mbit burst 128k 
 +root@gateway:~# tc class add dev eth0 parent 1:2 classid 1:3 htb rate 1mbit burst 128k 
 +root@gateway:​~#​ tc class add dev eth0 parent 1:2 classid 1:4 htb rate 2mbit burst 128k 
 + 
 +root@gateway:​~#​ tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dst 192.168.1.1 flowid 1:1 
 +root@gateway:​~#​ tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dst 192.168.1.2 match ip dport 1111 0xffff flowid 1:3 
 +root@gateway:​~#​ tc filter add dev eth0 protocol ip parent 1: prio 1 u32 match ip dst 192.168.1.2 flowid 1:4
 </​code>​ </​code>​
 </​solution>​ </​solution>​
- 
- 
saisp/labs/11/contents/06.1400405679.txt.gz · Last modified: 2014/05/18 12:34 by mihai.carabas
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0