You are not logged in.
Hi, I just researched how to achieve rate limiting at system-level, found nftables (which I didn’t know beforehand, only heard of iptables without using it either), and came up with this configuration:
table ip filter {
chain output {
type filter hook output priority filter; policy accept;
ip daddr 216.58.198.206 ct state new limit rate 20/minute drop
}
}
The hostname I’m trying to rate-limit to is youtube.com. I tried issuing curl requests in a loop and that seems to work.
I would like to know whether it is possible to dynamically adjust the IP filtered, I could make a loop of "nft replace rule … youtube.com …" but maybe there is a cleaner way.
Offline
Use sets and add/delete IP from the set.
Offline
Thanks I didn’t think of that, but that still requires monitoring to which IP youtube.com is resolved at a given time.
Last edited by Idlusen (2022-08-12 18:49:58)
Offline
Better way to do what you are doing is to use squid proxy. Blocking based on IP is not reliable.
Last edited by amish (2022-08-13 08:34:44)
Offline
I’ll look into that.
Offline