Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I found tc, which allows you to filter by ip, port etc. and then limit rates. But I was wondering if there was anything that could filter by application or limit rate given another process' socket ..


ok seems like

I can use lsof -iTCP and ipfw pipes ... wonder how efficient that is ..

lsof -iTCP:


ipfw in C:

with rate limiting (dummynet):

share|improve this question

migrated from Dec 16 '11 at 6:33

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

Netfilter (iptables) has the owner (and also a socket, if you wish to use that) module. With it you can apply standard firewall rules if user id or group id matches, and optionally match if the packet is associated with a socket.

iptables -t mangle -A PREROUTING -m owner -u some_user --socket-exists -j MARK --set-mark 100

Then just use tc in a way it catches mark 100:

tc filter add dev eth0 parent ffff: protocol ip prio 10 u32 match mark 100 ...

This was just my mindflow and I have no idea if this works, but give it a try. :)

share|improve this answer
The owner module also supports the specification of a PID: -m owner --pid-owner <pid> – the-wabbit Dec 16 '11 at 9:26
Oh, forgot that. Thanks :) – Janne Pikkarainen Dec 16 '11 at 9:28
Welcome. Although I doubt it will help resolve the question - the original poster seems to be using BSD. – the-wabbit Dec 16 '11 at 9:30
Let's see about that. This lottery could go both ways; tags mention Linux and I think tc is more Linux oriented command. – Janne Pikkarainen Dec 16 '11 at 9:33
Thanks, yes I was using BSD then switched to Linux so I could use tc. – Lavanya Jan 16 '12 at 3:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.