Skip to contentSkip to conversation

limiting bandwidth with iptables or squid?

DISCUSSION it clown 5 participants 8 messages Oct 24, 2004 – Oct 31, 2004

lore
Share & tools
lore

it clown

author
#0 lore raw

Hi All,

I would like to know how to limit bandwidth with iptables.I would like to limit bandwidth to ip's and mac address.Do i need another program to work with iptables or can iptables do it on its own?Does any one know where i can find something to read up on this?

If iptables can not do it can i do it with squid?

Regards
_____________________________________________________________________
For super low premiums ,click here http://www.dialdirect.co.za/quote

#1 lore raw
Quoted 9 lines · it clown

Hi All,

I would like to know how to limit bandwidth with iptables.I would like to limit bandwidth to ip's and mac address.Do i need another program to work with iptables or can iptables do it on its own?Does any one know where i can find something to read up on this?

If iptables can not do it can i do it with squid?

first off--you can't do "inbound" traffic shaping--only outbound. you cannot control how fast incoming packets hit your machine or how big they are--you can only control how fast you allow them to leave.

that being said--read chapter 9 of:

        http://lartc.org/howto/

-j

Signature · 1 line
Jason Opperisano <[email protected]>
author
#2 lore raw

Sorry i ment outbound traffic.Thanks, will check the url out.

Quoted 21 lines · On Sun, 24 Oct 2004 11:16:41 -0400 Jason Opperisano <[email protected]> wrote:
Quoted 3 lines · it clown

Hi All,

I would like to know how to limit bandwidth with

iptables.I

Quoted 1 line

would like to limit bandwidth to ip's and mac

address.Do i

Quoted 1 line

need another program to work with iptables or can

iptables

Quoted 4 lines

do it on its own?Does any one know where i can find something to read up on this?

If iptables can not do it can i do it with squid?

first off--you can't do "inbound" traffic shaping--only outbound. you
cannot control how fast incoming packets hit your machine or how big
they are--you can only control how fast you allow them to leave.

Quoted 10 lines

that being said--read chapter 9 of:

        http://lartc.org/howto/

-j

Signature · 1 line
Jason Opperisano <[email protected]>

_____________________________________________________________________
For super low premiums ,click here http://www.dialdirect.co.za/quote

#3 lore raw
In reply to Jason Opperisano
Quoted 10 lines · Jason Opperisano
Quoted 8 lines · it clown

Hi All,

I would like to know how to limit bandwidth with iptables.I would like to limit bandwidth to ip's and mac address.Do i need another program to work with iptables or can iptables do it on its own?Does any one know where i can find something to read up on this?

Quoted 4 lines
Quoted 1 line

If iptables can not do it can i do it with squid?

first off--you can't do "inbound" traffic shaping--only outbound.

I know your link qualifies this a bit - but I'd say you can do inbound (narrow end of bottleneck) traffic shaping. Albeit as an inperfect kludge and at the expense of some bandwidth. The imperfect bit being if you really care about latency - not bandwidth shaping, I would argue that I can do that almost perfectly as my ISP has a 600ms buffer and my shaping at 80% of 512kbit/s never looses control enough that packets get dropped from that.
you

Quoted 1 line

cannot control how fast incoming packets hit your machine

I assume TCP - which is clocked by acks - so the rate you dequeue does affect the rate at which packets hit ISP buffer. Packets never hit my machine faster than my link speed of course - which makes the queue get filled in a burstless way.

Quoted 1 line

or how big they are--

mss clamping :-)

Andy.

you can only control how fast you allow them to leave.

Quoted 7 lines

that being said--read chapter 9 of:

        http://lartc.org/howto/

-j

author
#4 lore raw

Hi All,

I am abit confused with tc.

I need a string to limit band whidth for ips or mac addresses.

iptables -A PREROUTING -i eth0 -s x.x.x.x -t mangle -j MARK --set-mark 1

will mark the packets for that ip.i think.

what string for tc do i need to limit x.x.x.x to say 5kb/s download speed? eth0 is my internal network card of my linux box.

Regards

Quoted 38 lines · On Mon, 25 Oct 2004 12:36:43 +0100 Andy Furniss <[email protected]>…
Quoted 5 lines · Jason Opperisano
Quoted 3 lines · it clown

Hi All,

I would like to know how to limit bandwidth with

iptables.I

Quoted 1 line
Quoted 1 line

would like to limit bandwidth to ip's and mac

address.Do i

Quoted 1 line
Quoted 1 line

need another program to work with iptables or can

iptables

Quoted 7 lines
Quoted 4 lines

do it on its own?Does any one know where i can find something to read up on this?

If iptables can not do it can i do it with squid?

first off--you can't do "inbound" traffic shaping--only

outbound.

I know your link qualifies this a bit - but I'd say you can do inbound (narrow end of bottleneck) traffic shaping. Albeit as an inperfect kludge and at the expense of some bandwidth. The imperfect bit being if you really care about latency - not bandwidth shaping, I would argue that I can do that almost perfectly as my ISP has a 600ms buffer and my shaping at 80% of 512kbit/s never looses control enough that packets get dropped from that.
you

Quoted 1 line

cannot control how fast incoming packets hit your

machine

I assume TCP - which is clocked by acks - so the rate you dequeue does affect the rate at which packets hit ISP buffer. Packets never hit my machine faster than my link speed of course - which makes the queue get filled in a burstless way.

Quoted 17 lines
Quoted 1 line

or how big they are--

mss clamping :-)

Andy.

you can only control how fast you allow them to leave.

Quoted 7 lines

that being said--read chapter 9 of:

        http://lartc.org/howto/

-j

_____________________________________________________________________
For super low premiums ,click here http://www.dialdirect.co.za/quote

#5 lore raw
Quoted 9 lines · it clown

Hi All,

I am abit confused with tc.

I need a string to limit band whidth for ips or mac addresses.

iptables -A PREROUTING -i eth0 -s x.x.x.x -t mangle -j MARK --set-mark 1

If you want to shape traffic from the internet to certain IPs there are several ways -
you could mark them on the WAN interface eg. -i ppp0. If you do it in PREROUTING and are doing NAT it won't work for local addresses, though.

If you do not care about shaping traffic headed for your shaping box and you only have one lan interface you can set up HTB/CBQ/HFSC egress on eth0. You could then use POSTROUTING to mark IPs which will be denatted
at that point.

Quoted 7 lines

will mark the packets for that ip.i think.

what string for tc do i need to limit x.x.x.x to say 5kb/s download speed? eth0 is my internal network card of my linux box.

I would use HTB - there are examples and links on www.docum.org / LARTC how to.

You will need to run at about 80% of your link speed.

Andy.

#6 lore raw
In reply to it clown

You could look at iproute2 the command tc

lets you do traffic shapping!

So you could mark up packets in iptables and then traffic shape based on that

A

Quoted 15 lines · it clown

Hi All,

I would like to know how to limit bandwidth with iptables.I would like to limit bandwidth to ip's and mac address.Do i need another program to work with iptables or can iptables do it on its own?Does any one know where i can find something to read up on this?

If iptables can not do it can i do it with squid?

Regards
_____________________________________________________________________
For super low premiums ,click here http://www.dialdirect.co.za/quote

#7 lore raw
In reply to it clown

Why don't you take a look at man tc ?

Greets,

M

Quoted 13 lines · it clown

Hi All,

I would like to know how to limit bandwidth with iptables.I would like to limit bandwidth to ip's and mac address.Do i need another program to work with iptables or can iptables do it on its own?Does any one know where i can find something to read up on this?

If iptables can not do it can i do it with squid?

Regards
_____________________________________________________________________
For super low premiums ,click here http://www.dialdirect.co.za/quote

Signature · 3 lines
Matteo Santori / matteo<at>tilde.it
Key Fingerprint = AF3B B1BC 6338 4680 DB49  8176 E409 0870 60EC BB3E
PGP PublicKey available at: http://pgp.mit.edu