Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Limiting outbound ports bandwith
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
mikeraach
Apprentice
Apprentice


Joined: 20 Jan 2003
Posts: 168

PostPosted: Fri Mar 12, 2004 10:33 pm    Post subject: Limiting outbound ports bandwith Reply with quote

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
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Sat Mar 13, 2004 2:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
nbensa
l33t
l33t


Joined: 10 Jul 2002
Posts: 799
Location: Buenos Aires, Argentina

PostPosted: Sat Mar 13, 2004 2:38 pm    Post subject: Reply with quote

Can you post that QoS script?

Thank you,
Norberto
Back to top
View user's profile Send private message
nielchiano
Veteran
Veteran


Joined: 11 Nov 2003
Posts: 1287
Location: 50N 3E

PostPosted: Sat Mar 13, 2004 2:53 pm    Post subject: Reply with quote

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
View user's profile Send private message
mikeraach
Apprentice
Apprentice


Joined: 20 Jan 2003
Posts: 168

PostPosted: Sat Mar 13, 2004 7:29 pm    Post subject: Reply with quote

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
View user's profile Send private message
Toro_g
n00b
n00b


Joined: 30 Mar 2004
Posts: 25

PostPosted: Sun Apr 11, 2004 9:12 pm    Post subject: Reply with quote

I hope too.
Would need it too :).
Back to top
View user's profile Send private message
ikaro
Advocate
Advocate


Joined: 14 Jul 2003
Posts: 2527
Location: Denmark

PostPosted: Mon Apr 12, 2004 9:14 am    Post subject: Reply with quote

^ bump
_________________
linux: #232767
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum