View previous topic :: View next topic |
Author |
Message |
mikeraach Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/10236984203e738ca4c363c.gif)
Joined: 20 Jan 2003 Posts: 168
|
Posted: Fri Mar 12, 2004 10:33 pm Post subject: Limiting outbound ports bandwith |
|
|
Many upon many threads about bandwith limiting...wondershaper, cbq...etc
I have yet to find a simple script that does what the title says...Limit outbound bandwith on certain ports.
Example: I have a 62kb/s upload. If I set wondershaper to limit me at 50kb/s, other computers on the lan get great pings becuase there is 12kb/s left on the line. But since wondershaper is limiting _my_ computers available pipe, pings are just as bad with and without wondershaper.
Basically I just want to limit ftp (I'm behind a router so I have to use passive mode), http, bittorent, and maybe a few other things to have only 50kb/s combined. Any other network (such as a game) can use how much ever it needs. Is there such a beast or am I stuck reading through the manuals and figuring everything out myself?
I just figure other people have had similar needs as I and they either know of a script or could show me theirs.
Thanks in advance. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nielchiano Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 11 Nov 2003 Posts: 1287 Location: 50N 3E
|
Posted: Sat Mar 13, 2004 2:30 pm Post subject: |
|
|
the trick is to use QoS. It's a bit tricky to get set up. Try READING the wondershaper set up.
You can arrange all outgoing traffic in different queues and give prioritys for them. If you want I can post my QoS script (based on the wondershaper). It gives priority to interactive traffic (telnet, ping etc) and gives HTTP and stuff the rest. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nbensa l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/117650096546f8888899d81.jpg)
Joined: 10 Jul 2002 Posts: 799 Location: Buenos Aires, Argentina
|
Posted: Sat Mar 13, 2004 2:38 pm Post subject: |
|
|
Can you post that QoS script?
Thank you,
Norberto |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
nielchiano Veteran
![Veteran Veteran](/images/ranks/rank_rect_5_vet.gif)
Joined: 11 Nov 2003 Posts: 1287 Location: 50N 3E
|
Posted: Sat Mar 13, 2004 2:53 pm Post subject: |
|
|
if something is not clear, ask!
It doesn't do what you asked for, but demonstrates the QoS, so you'd be able to write your own
Code: |
# QoS
#####
# Clean up existing qdiscs (should not be none, since the interface is just
# up, but anyway) and suppress errors
$TC qdisc del dev $IFNAME root > /dev/null 2> /dev/null
$TC qdisc del dev $IFNAME ingress > /dev/null 2> /dev/null
# QoS UPSTREAM
##############
# Root gets HTB, default in 1:20
$TC qdisc add dev $IFNAME root handle 1: htb default 20
# Max rate is $UPLOAD_RATE
$TC class add dev $IFNAME parent 1: classid 1:1 htb \
rate ${UPLOAD_RATE}kbit burst 6k
# High prio class 1:10
$TC class add dev $IFNAME parent 1:1 classid 1:10 htb \
rate ${UPLOAD_RATE}kbit burst 6k prio 1
# Low prio class 1:20 (default)
$TC class add dev $IFNAME parent 1:1 classid 1:20 htb \
rate $[9*$UPLOAD_RATE/10]kbit burst 6k prio 2
# Give them stochastic fairness
$TC qdisc add dev $IFNAME parent 1:10 handle 10: sfq perturb 10
$TC qdisc add dev $IFNAME parent 1:20 handle 20: sfq perturb 10
# Filters
# -------
# TOS Minimum Delay in 1:10
$TC filter add dev $IFNAME parent 1: protocol ip prio 10 u32 \
match ip tos 0x10 0xff flowid 1:10
# ICMP (IP protocol 1) in 1:10
$TC filter add dev $IFNAME parent 1: protocol ip prio 10 u32 \
match ip protocol 1 0xff flowid 1:10
# ACK packets in 1:10
# ACKs are:
# TCP (ip protocol 6)
# Short header (20 bytes)
# ACK bit set (0x10/0xff at TCP-hdr+14)
# No payload (total length < 64B at 2)
$TC filter add dev $IFNAME parent 1: protocol ip prio 10 u32 \
match ip protocol 6 0xff \
match u8 0x05 0x0f at 0 \
match u8 0x10 0xff at nexthdr+14 \
match u16 0x0000 0xffc0 at 2 \
flowid 1:10
# Rest ends up in 1:20
# QoS DOWNSTREAM
################
# ingress policer
$TC qdisc add dev $IFNAME handle ffff: ingress
# filter ALL (0.0.0.0/0)
$TC filter add dev $IFNAME parent ffff: protocol ip prio 50 u32 \
match ip src 0.0.0.0/0 police rate ${DOWNLOAD_RATE}kbit burst \
10k drop flowid :1
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
mikeraach Apprentice
![Apprentice Apprentice](/images/ranks/rank_rect_2.gif)
![](images/avatars/10236984203e738ca4c363c.gif)
Joined: 20 Jan 2003 Posts: 168
|
Posted: Sat Mar 13, 2004 7:29 pm Post subject: |
|
|
A lot of that looks similar to wondershaper (which I have read) but all of it is foreign to me.
I _could_ go read through all the docs and figure out what everything is, but I was just hoping someone that has read them had made a script (or has a script) similar to my needs. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Toro_g n00b
![n00b n00b](/images/ranks/rank_rect_0.gif)
Joined: 30 Mar 2004 Posts: 25
|
Posted: Sun Apr 11, 2004 9:12 pm Post subject: |
|
|
I hope too.
Would need it too . |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
ikaro Advocate
![Advocate Advocate](/images/ranks/rank-G-1-advocate.gif)
![](images/avatars/130830920042dd3d4464379.jpg)
Joined: 14 Jul 2003 Posts: 2527 Location: Denmark
|
Posted: Mon Apr 12, 2004 9:14 am Post subject: |
|
|
^ bump _________________ linux: #232767 |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|