Is it possible to limit output bandwidth between eth0 and lo?

Posted by mmcbro on Server Fault See other posts from Server Fault or by mmcbro
Published on 2014-05-31T15:02:02Z Indexed on 2014/05/31 15:30 UTC
Read the original article Hit count: 264

Filed under:
|
|
|

I'm trying to limit the bandwidth between my eth0 output (nginx proxy) to my loopback inteface (apache) by filtering on destination port.

Incoming Packet -> Eth0 -> 0.0.0.0:80 Nginx -> tc qdisc class/iptable mangle 2525port -> 127.0.0.1:2525 Apache

I don't know if it's even possible I'm just experimenting.

My rules are the followings :

tc qdisc add dev eth0 root handle 1:0 htb
tc class add dev eth0 parent 1:0 classid 1:10 htb rate 2mbps ceil 2mbps prio 0
tc filter add dev eth0 parent 1:0 prio 0 protocol ip handle 10 fw flowid 1:10

iptables -A OUTPUT -t mangle -p tcp --dport 2525 -j MARK --set-mark 10

I also tried to with FORWARD chain but its still the same.

© Server Fault or respective owner

Related posts about nginx

Related posts about bandwidth