← Back to team overview

sslug-teknik team mailing list archive

Re: Begrænse båndbredde til router/internet men ikke til lokale maskiner?

 

Her den del af scriptet hvor jeg tror der skal ændres:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
# start filters
# TOS Minimum Delay (ssh, NOT scp) in 1:10:
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
      match ip tos 0x10 0xff  flowid 1:10

# ICMP (ip protocol 1) in the interactive class 1:10 so we
# can do measurements & impress our friends:
tc filter add dev $DEV parent 1:0 protocol ip prio 11 u32 \
        match ip protocol 1 0xff flowid 1:10

# pablo.iranzo@xxxxx provided a patch for the MLDonkey system
# The MLDonkey uses small UDP packets for source propogation
# which floods the wondershaper out.
tc filter add dev $DEV parent 1:0 protocol ip prio 10 u32 \
   match ip protocol 17 0xff \
   match ip sport 4666 0xffff \
   flowid 1:30

# prioritize small packets (<64 bytes)

tc filter add dev $DEV parent 1: protocol ip prio 12 u32 \
   match ip protocol 6 0xff \
   match u8 0x05 0x0f at 0 \
   match u16 0x0000 0xffc0 at 2 \
   flowid 1:10


# some traffic however suffers a worse fate
for a in $NOPRIOPORTDST
do
        tc filter add dev $DEV parent 1: protocol ip prio 14 u32 \
           match ip dport $a 0xffff flowid 1:30
done

for a in $NOPRIOPORTSRC
do
        tc filter add dev $DEV parent 1: protocol ip prio 15 u32 \
           match ip sport $a 0xffff flowid 1:30
done

for a in $NOPRIOHOSTSRC
do
        tc filter add dev $DEV parent 1: protocol ip prio 16 u32 \
           match ip src $a flowid 1:30
done

for a in $NOPRIOHOSTDST
do
        tc filter add dev $DEV parent 1: protocol ip prio 17 u32 \
           match ip dst $a flowid 1:30
done

# rest is 'non-interactive' ie 'bulk' and ends up in 1:20

tc filter add dev $DEV parent 1: protocol ip prio 18 u32 \
   match ip dst 0.0.0.0/0 flowid 1:20


########## downlink #############
# slow downloads down to somewhat less than the real speed  to prevent
# queuing at our ISP. Tune to see how high you can set it.
# ISPs tend to have *huge* queues to make sure big downloads are fast
#
# attach ingress policer:

tc qdisc add dev $DEV handle ffff: ingress

# filter *everything* to it (0.0.0.0/0), drop everything that's
# coming in too fast:

tc filter add dev $DEV parent ffff: protocol ip prio 50 u32 match ip src \
   0.0.0.0/0 police rate ${DOWNLINK}kbit burst 10k drop flowid :1
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

On 15/4-2005, at 16.09, Jesper Krogh wrote:

I sslug.teknik, skrev Tobias Balle-Petersen:
 Nedenstående er vidst de 3 regler. Hvordan tilføjer jeg mit lokale
 netværk til den første regel?

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 - - - - - - - -
 # high prio class 1:10:

tc class add dev $DEV parent 1:1 classid 1:10 cbq rate ${UPLINK}kbit \
     allot 1600 prio 1 avpkt 1000

 # bulk and default class 1:20 - gets slightly less traffic,
 #  and a lower priority:

 tc class add dev $DEV parent 1:1 classid 1:20 cbq rate
 $((9*$UPLINK/10))kbit \
     allot 1600 prio 2 avpkt 1000

 # 'traffic we hate'

 tc class add dev $DEV parent 1:1 classid 1:30 cbq rate
 $((8*$UPLINK/10))kbit \
     allot 1600 prio 2 avpkt 1000

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Ovenstående stykke opretter kun "køerne" du skal ned til den sektion
efter "start filters" og tilføje et filter for dit netværk.

Jesper

--
./Jesper Krogh, jesper@xxxxxxxx, Jabber ID: jesper@xxxxxxxxxxxx
... der er blevet medlem af Free Software Foundation i denne uge:
https://www.fsf.org/associate/join/am_join_form1





Med venlig hilsen,
Tobias Balle-Petersen

______________________________________________________________________

Tobias Balle-Petersen / System Administrator





Kontrapunkt / Refshalevej 153 / 1432 Copenhagen K / Denmark
Tel +45 33 93 18 83 / +45 28 88 21 25 / tbp@xxxxxxxxxxxxxxx / www.kontrapunkt.com



Follow ups

References