Networking Forums

Networking Forums > Computer Networking > Linux Networking > upstream bandwidth limiting with tc & iptables

Reply
Thread Tools Display Modes

upstream bandwidth limiting with tc & iptables

 
 
Glenn Sherman
Guest
Posts: n/a

 
      12-13-2004, 10:21 PM
I cannot seem to limit upstream bandwidth.
I have set up tc & iptables to limit downloading, but I am trying to
get them to limit uploading as well.
Is there any way to do this?

I currently have the following (without extra class info)
# tc qdisc add dev eth1 root handle 1: htb default 10
# tc class add dev eth1 parent 1: classid 1:1 htb rate 9Mbit ceil 9Mbit
# tc class add dev eth1 parent 1:1 classid 1:10 htb rate 5Mbit ceil 5Mbit
# tc class add dev eth1 parent 1:1 classid 1:30 htb rate 768kbit ceil
768kbit
# tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10
# tc qdisc add dev eth1 parent 1:30 handle 30: sfq perturb 10
# tc filter add dev eth1 protocol ip parent 1:0 prio 1 handle 6 fw flowid
1:30

# iptables -A FORWARD -t mangle -i eth0 -d 192.168.1.6 -j MARK --set-mark 6

eth0 is WAN adapter with IP 216.x.y.z
eth1 is LAN adapter with IP 192.168.1.254

If I download a file using ftp - I get about 768Kbits.
If I upload a file using ftp - I get the full speed of the line ( 20Mbit )

I can't seem to generate the correct iptables entry that would allow me to
limit the upstream bandwidth.
I am currently nat'ing the LAN ip with # iptables -t nat -A POSTROUTING -o
$EXTIF -j MASQUERADE
this is for testing, later I will be putting a public ClassC address on the
LAN side.(if that matters)

-Glenn Sherman
(bogus email)




 
Reply With Quote
 
 
 
 
Andy Furniss
Guest
Posts: n/a

 
      12-15-2004, 12:50 PM
Glenn Sherman wrote:

> I cannot seem to limit upstream bandwidth.
> I have set up tc & iptables to limit downloading, but I am trying to
> get them to limit uploading as well.
> Is there any way to do this?
>
> I currently have the following (without extra class info)
> # tc qdisc add dev eth1 root handle 1: htb default 10
> # tc class add dev eth1 parent 1: classid 1:1 htb rate 9Mbit ceil 9Mbit
> # tc class add dev eth1 parent 1:1 classid 1:10 htb rate 5Mbit ceil 5Mbit
> # tc class add dev eth1 parent 1:1 classid 1:30 htb rate 768kbit ceil
> 768kbit
> # tc qdisc add dev eth1 parent 1:10 handle 10: sfq perturb 10
> # tc qdisc add dev eth1 parent 1:30 handle 30: sfq perturb 10
> # tc filter add dev eth1 protocol ip parent 1:0 prio 1 handle 6 fw flowid
> 1:30


You should be using eth0.

>
> # iptables -A FORWARD -t mangle -i eth0 -d 192.168.1.6 -j MARK --set-mark
> # 6


It should be -o eth0 and the dst addresses will be WAN adresses.

> eth0 is WAN adapter with IP 216.x.y.z
> eth1 is LAN adapter with IP 192.168.1.254
>
> If I download a file using ftp - I get about 768Kbits.
> If I upload a file using ftp - I get the full speed of the line ( 20Mbit )
>
> I can't seem to generate the correct iptables entry that would allow me to
> limit the upstream bandwidth.
> I am currently nat'ing the LAN ip with # iptables -t nat -A POSTROUTING
> -o $EXTIF -j MASQUERADE
> this is for testing, later I will be putting a public ClassC address on
> the LAN side.(if that matters)


NAT can make things different, though I don't think it will affect you.

Have a look at www.docum.org generally and in particular the KPTD.

Andy.



>
> -Glenn Sherman
> (bogus email)
>
>
>
>


 
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
bandwidth limiting vita Windows Networking 0 09-16-2006 06:42 AM
QoS and bandwidth limiting mneagul Linux Networking 0 08-04-2006 07:28 PM
Bandwidth limiting Ed Russell Linux Networking 1 02-09-2005 11:24 PM
Aggregating upstream bandwidth Draxen Broadband 4 09-26-2003 06:00 PM
Aggregating upstream bandwidth Draxen Linux Networking 5 09-23-2003 04:03 PM



1 2 3 4 5 6 7 8 9 10 11