Witam,
 
tak się bawię własnym skryptem generującym rc.limits i zastanawiam się nad rozwiązaniem problemu dowiązania komputera klienta do taryfy.
W czym rzecz. Oto przykład:
 
Klient BB Aa (np ID 1240) ma trzy komputery:
 
komputer A - osobna taryfa 128kbps
komputer B - osobna taryfa 128kbps
komputer C - osobna taryfa 610kbps
 
na chwilę obecną lms-traffic-htbiptlimits generuje coś mniejwięcej takiego:
 
/usr/sbin/iptables -t mangle -A LIMITS -s xx.xx.88.183 -j MARK --set-mark 964
/usr/sbin/iptables -t mangle -A LIMITS -s xx.xx.89.4 -j MARK --set-mark 964
/usr/sbin/iptables -t mangle -A LIMITS -s xx.xx.89.5 -j MARK --set-mark 964
/sbin/tc class add dev eth1 parent 1:19999 classid 1:482 htb rate 264kbit ceil 866kbit burst 33kbit
/sbin/tc filter add dev eth1 protocol ip parent 1: handle 964 fw classid 1:482
 
czyli sumuje downceil/downrate i tworzy z tego jedną klasę. Czy w w/w przypadku nie lepiej było by zrobić coś w ten deseń ?
 
/usr/sbin/iptables -t mangle -A LIMITS -s xx.xx.88.183 -j MARK --set-mark 964
/usr/sbin/iptables -t mangle -A LIMITS -s xx.xx.89.4 -j MARK --set-mark 965
/usr/sbin/iptables -t mangle -A LIMITS -s xx.xx.89.5 -j MARK --set-mark 966
/sbin/tc class add dev eth1 parent 1:19999 classid 1:482 htb rate 264kbit ceil 866kbit burst 33kbit
/sbin/tc class add dev eth1 parent 1:482 classid 1:483 htb rate 128kbit ceil 128kbit burst 33kbit
/sbin/tc class add dev eth1 parent 1:482 classid 1:484 htb rate 128kbit ceil 128kbit burst 33kbit
/sbin/tc class add dev eth1 parent 1:482 classid 1:485 htb rate 8kbit ceil 610kbit burst 33kbit
/sbin/tc filter add dev eth1 protocol ip parent 1: handle 965 fw classid 1:483
/sbin/tc filter add dev eth1 protocol ip parent 1: handle 966 fw classid 1:484
/sbin/tc filter add dev eth1 protocol ip parent 1: handle 964 fw classid 1:485
 
dla wielu komputerów w jednej taryfie generuje poprawnie. Sam algorytm budowania klas w klasie jest prosty, o tyle mam problem z zapytaniem SQL, które wiąże komputery klienta z odpowiednią taryfą.
 
w pliku lms-traffic-htbiptlimits "zauważyłem", że jest tam robiona suma wartości downceil/downrate - to samo tyczy się z wartościami dla uploadu.
 
I teraz moje pytanie -  o odpowiednie zapytanie SQL, które mogło by dopasować odpowiedni "IP" do danej taryfy.
Jak rozwinąć ten przykład ?
 
mysql> SELECT tariffid FROM assignments WHERE customerid = 1240;
+----------+
| tariffid |
+----------+
|       44 |
|       44 |
|       32 |
+----------+
3 rows in set (0.00 sec)
 
widzę, ze customerid = 1240 to trzy osobne taryfy - odpowiednio 44, 44, 32 dla różnych komputerów. Jednakże jak to "dowiązać" wyciągająć z BAZY dopisane do taryfy komputery klienta ? (jeśli są dwie "taryfy" te same z osobna ?)
 
--
dzimi