Newbies about per IP bandwidth control, I can't understand something about hash filter

Linux Advanced Routing and Traffic Control

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hi
I want to implement a traffic control for per users in a 192.168.17.0/24 sub network, but I wonder whether the script I wrote would work as I want, and I have something can't understand in the filter part. --------------------The part limit the download speed-----------------------------
tc qdisc add dev lan root handle 1: htb default 1
# I want those IPs which are not in range won't be filter, they could use the whole bandwidth,
# so they would go to the classid 1:1
tc class add dev lan parent 1:0 classid 1:1 htb rate 100Mbit

tc class add dev lan parent 1:1 classid 1:18 htb rate 10Mbit ceil 50Mbit
tc filter add dev lan protocol ip parent 1:0 prio 100 u32 ht 2:18: match ip dst 192.168.17.18 flowid 1:18

tc class add dev lan parent 1:1 classid 1:19 htb rate 10Mbit ceil 50Mbit
tc filter add dev lan protocol ip parent 1:0 prio 100 u32 ht 2:19: match ip dst 192.168.17.19 flowid 1:19
...
tc class add dev lan parent 1:1 classid 1:39 htb rate 10Mbit ceil 50Mbit
tc filter add dev lan protocol ip parent 1:0 prio 100 u32 ht 2:39: match ip dst 192.168.17.39 flowid 1:39 # add classes and filters for a IP range, from 192.168.17.18/24 to 192.168.17.39, # I want All the IPs in this range share the 50Mbis download bandwidth totally,
#but I don't know what the rate argument do in here?

tc filter add dev lan parent 1:0 prio 10 protocol ip u32
tc filter add dev lan parent 1:0 protocol ip prio 10 handle 2: u32 divisor 256 # As I don't create so many sub filter for it, when it found those a filter match it, what it will do, go back to
# the default class?

tc filter replace dev lan parent 1:0 protocol ip prio 10 u32 ht 800:: \
    match ip dst 192.168.17.0/24 \
    hashkey mask 0x000000ff at 16 link 2:


And I can't understand when I should I use ifb device, if I want to limit the upload speed, I could do that in the egress of wan. I don't need to redirect the ingress of lan to ifb, as I meet some problem with ifb as https://dev.openwrt.org/ticket/21374#comment:2

Finally, if I want to use the cls_flow to limit the upload speed in wan(it would do an NAT) instead of iptables marking , how should I write my rules?

Thank you a lot

--
To unsubscribe from this list: send the line "unsubscribe lartc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [LARTC Home Page]     [Netfilter]     [Netfilter Development]     [Network Development]     [Bugtraq]     [GCC Help]     [Yosemite News]     [Linux Kernel]     [Fedora Users]
  Powered by Linux