I use Ubuntu server 10.04 with the stock kernel as a NAT router. I use iptables and tc to do port based traffic prioritization. It is working fine. I have given http higher priority. So my network gets swamped with youtube and bigger http downloads. My question is: Is it possible to make iptables recognize and mark packets that belong to youtube streams or larger files? my goal is to make webpage browsing faster.
|
feedback
|
|
You can try using However, I tend to agree with the others that for this purpose, you should use something that works at Layer 7. Example usage of
|
My eth0 is WAN, and eth1 is LAN interface. So what would be the iptables connbytes syntax to mark packets if data download goes above 512 kB. – nixnotwin Apr 20 '11 at 14:23 |
|
I tried it, the rules got applied, but when I did iptables -v -L, it doesn't show any bytes or packets that are transferred. Here are my entire qos rules:pastebin.com/2vkmptbA – nixnotwin Apr 21 '11 at 14:04 |
|
@nixnotwin unfortunately I'm not (yet) familiar with tc. can you replace the -j on both rule with -j LOG --log-prefix somestring, and see in dmesg if the rules 'fired'? – pepoluan Apr 21 '11 at 14:18 |
|
This from the perspective of You could tag packets routed to and from Youtube and filter those separately, but I find the last thing you want to do with streaming media is slow it down. The faster it happens the happier the users are and the sooner the traffic is out of the way. You can use TC to put everything coming from Youtube servers (by IP block) into a lower priority queue, but if your users are still watching videos, whether they take a long time or a short time to download the same number of bytes are going to move over your network. I suggest you consider this at least partially an HR problem and make and enforce (using human communication not digital detection) some acceptable use policies. Then if you still need network capacity, grow your infrastructure a little. | |||
feedback
|
|
As already posted by Caleb, this is not a task for iptables as you are lacking "proper" content inspection features there. You might want to take a look into a HTTP proxy like Squid. Recent versions come with sophisticated bandwidth regulation mechanisms called "delay pools" which can be combined with tagging mechanisms called "ACLs" for complex bandwidth management scenarios. We have set up squid installations at customer sites with requirements pretty similar to yours. | |||
|
feedback
|