This shows you the differences between two versions of the page.
saisp:labs:11:contents:06 [2014/01/26 13:07] 127.0.0.1 external edit |
saisp:labs:11:contents:06 [2014/05/18 14:27] (current) mihai.carabas |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | ==== 06. Lorem ipsum ==== | + | ==== 06. [15p] Politici de limitare per client ==== |
- | ... | + | Ștergeți qdisc-ul root adăugat anterior. |
+ | 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 (Hint: folosiți 2 reguli de ''match'' ale clasificatorului ''u32'') | ||
+ | * 2mbps pentru traficul de pe restul porturilor | ||
+ | Testați folosind ''iperf''. | ||
+ | |||
+ | <solution -hidden> | ||
+ | <code bash> | ||
+ | root@gateway:~# tc qdisc del dev eth0 root | ||
+ | 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 | ||
+ | |||
+ | root@gateway:~# tc class add dev eth0 parent 1: classid 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> | ||
+ | </solution> |