1

Im currently working on a traffic shaping in linux. We have a client connected to a server running nat and dhcp. What we want to do is limit both the upload and download speed of the client/clients.

However only download limit works.

Download limit(Part of the script) WORKING

tc class add dev eth1 parent 1:1 classid 1:4 htb rate 30000kbit
tc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip dst 192.168.0.101/32 flowid 1:4

Upload limit(Part of the script)

tc class add dev eth1 parent 1:1 classid 1:4 htb rate 30000kbit
tc filter add dev eth1 protocol ip parent 1:0 prio 1 u32 match ip src 192.168.0.101/32 flowid 1:4

The only thing that is changed in the upload part is "dst" to "src" Problem is when we replace the download part of the script with the upload part, no limiting is done.? what is wrong

martio09
  • 11
  • 1
  • From your description, I can say that `192.168.0.101` should be the client IP. That's fine. You said there is NATing in your setup. You need to confirm the IP address seen by your server on the right interface. If you are unsure, you can use `tcpdump` to trace it. – Khaled Apr 16 '13 at 11:58
  • I have tried using wireshark and i can confirm that packets are registered (on eth1 interface, that is the LAN interface,) with the right ip adresse. Dst and src are 192.168.0.101 when reciving and sending packets. – martio09 Apr 16 '13 at 12:44

1 Answers1

0

your traffic shaping application is running on your server with ip address 192.168.0.101 .so you just can control download bandwidth by a filter with src 192.168.0.101 . when you use a filter with dst 192.168.0.101 , packets first are received in server then traffic shaping is done on them so you can not control upload bandwidth . to do it you should use a machine between your server and your users to control download and upload bandwidth by these both filters.

samie
  • 47
  • 8