I have a ubuntu machine with two interfaces. eth1 is the NAT interface and eth2 is the WAN iterface. I have a 4 mbps internet connection. I want to limit it to 2 mbps for the eth1 NAT network. So I use this tc rule:
tc qdisc add dev eth1 root tbf rate 2mbit burst 10kb latency 70ms peakrate 2.4mbit minburst 1540
Now, if I check the bandwidth that goes out of eth1 it is resticted to 250 KBps, which is good. But the bandwidth that comes in at eth2 is more than that: it will be in between 300 KBps to 400 KBps. If I check the status of the tc rule, it shows heavy packet drop. How can I restrict the incoming bandwidth at eth2 to 2 mbits and How can I prevent packet loss?
I tried the solution given in this answer. The line
tc qdisc add dev eth2 ingress gave me a
file exists error. The second approach in the answer showed the same behaviour I refered to here: more data (above 2mbit) getting in via eth2.
EDIT 1: What iptables and tc rules I can use to slow down SYN, ACK, FIN packets so as to make ISP routers aware of the congestion on my local network.