Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Prioritering av IP adresser og porter
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Scandinavian
View previous topic :: View next topic  
Author Message
esse
n00b
n00b


Joined: 08 May 2005
Posts: 5

PostPosted: Sun May 08, 2005 1:44 pm    Post subject: Prioritering av IP adresser og porter Reply with quote

Hei.

Er det noen som kan forklare meg litt hva jeg trenger for og få til prioritering av porter og ipadresser på mitt hjemme nettverk.

Jeg har følgende oppsett idag.


adsl modem
|
Linux server,gateway, 192.168.0.2
|
Switch
||||
||| VoIP,IPtele,192.168.0.3
|||
||| WINXP
||
|| Linux, 192.168.0.4
|
| Win3.11


Det jeg håper på og få til er en prioritering som følgende

1 pri: ssh:192.168.0.2
2 pri: ssh:192.168.0.4
3 pri: iptele:192.168.0.3
4 pri: websurf: alle iper
5 pri: epost: alle iper
6 pri: msn: alle iper
7 pri: irc: alle iper
8 pri: ftp ned: alle iper

Hilsen Espen
Back to top
View user's profile Send private message
creideiki
n00b
n00b


Joined: 19 Feb 2003
Posts: 59
Location: Linköping, Sweden

PostPosted: Sun May 08, 2005 3:58 pm    Post subject: Reply with quote

Du vill läsa Linux Advanced Routing & Traffic Control HOWTO, särskilt kapitel 9: Queueing Disciplines for Bandwidth Management. Avsnitt 9.6.1 har lite exempelkod du kan börja leka med.
Back to top
View user's profile Send private message
esse
n00b
n00b


Joined: 08 May 2005
Posts: 5

PostPosted: Fri May 20, 2005 10:12 pm    Post subject: Reply with quote

Hei

Da har jeg prøvd og lese litt om prioritering av internett linja mi.
Jeg har prøvd og få en fordeling av hastigheten utifra hvilke porter som brukes men jeg er ikke helt sikker på om jeg har forstått det riktig.
Prøver og styre hastigheten på alle PC'er i nettverket utifra hvilke porter programene bruker.
Men hvis noen har noen forslag til endringer hadde det vært fint med litt hjelp.

#!/bin/bash

# Zap the iptables mangle queue
iptables -t mangle -F

# Internet device
OUT=eth1

# Flow rates

MAX=704kbit
SSH=400kbit
IPTELE=704kbit
WEBSURF=400kbit
EPOST=100kbit
MSN=200kbit
IRC=100kbit
FTP=100kbit
EMULE=50kbit
BITTORENT=50kbit


# Delete existing shaping
tc qdisc del dev $OUT root

# ===========
# Our classes
# ===========
# Top
tc qdisc add dev $OUT root handle 1: htb default 130
tc class add dev $OUT parent 1: classid 1:1 htb rate $MAX

tc class add dev $OUT parent 1:1 classid 1:10 htb rate $MAX
tc class add dev $OUT parent 1:1 classid 1:20 htb rate $SSH ceil $SSH
tc class add dev $OUT parent 1:1 classid 1:30 htb rate $IPTELE ceil $IPTELE
tc class add dev $OUT parent 1:1 classid 1:40 htb rate $WEBSURF ceil $WEBSURF
tc class add dev $OUT parent 1:1 classid 1:50 htb rate $EPOST ceil $EPOST
tc class add dev $OUT parent 1:1 classid 1:60 htb rate $MSN ceil $MSN
tc class add dev $OUT parent 1:1 classid 1:70 htb rate $IRC ceil $IRC
tc class add dev $OUT parent 1:1 classid 1:80 htb rate $FTP ceil $FTP
tc class add dev $OUT parent 1:1 classid 1:90 htb rate $EMULE ceil $EMULE
tc class add dev $OUT parent 1:1 classid 1:100 htb rate $BITTORENT ceil $BITTORENT
tc class add dev $OUT parent 1:1 classid 1:110 htb rate $MAX ceil $MAX

# Rehashing
tc qdisc add dev $OUT parent 1:10 handle 10: sfq perturb 10
tc qdisc add dev $OUT parent 1:20 handle 20: sfq perturb 10
tc qdisc add dev $OUT parent 1:30 handle 30: sfq perturb 10
tc qdisc add dev $OUT parent 1:40 handle 40: sfq perturb 10
tc qdisc add dev $OUT parent 1:50 handle 50: sfq perturb 10
tc qdisc add dev $OUT parent 1:60 handle 60: sfq perturb 10
tc qdisc add dev $OUT parent 1:70 handle 70: sfq perturb 10
tc qdisc add dev $OUT parent 1:80 handle 80: sfq perturb 10
tc qdisc add dev $OUT parent 1:90 handle 90: sfq perturb 10
tc qdisc add dev $OUT parent 1:100 handle 100: sfq perturb 10
tc qdisc add dev $OUT parent 1:110 handle 110: sfq perturb 10

# ===================
# the magic begins...
# ===================

# SSH
iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 22 -j MARK --set-mark 2
tc filter add dev $OUT protocol ip parent 1:0 handle 2 fw flowid 1:20

# IPTELE
#iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 20:21 -j MARK --set-mark 3
#tc filter add dev $OUT protocol ip parent 1:0 handle 3 fw flowid 1:30

# WEBSURF
iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 40 -j MARK --set-mark 4
tc filter add dev $OUT protocol ip parent 1:0 handle 4 fw flowid 1:40

# EPOST
iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 110 -j MARK --set-mark 5
tc filter add dev $OUT protocol ip parent 1:0 handle 5 fw flowid 1:50

# MSN
iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 1863 -j MARK --set-mark 6
tc filter add dev $OUT protocol ip parent 1:0 handle 6 fw flowid 1:60

# IRC
iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 6665:6669 -j MARK --set-mark 7
tc filter add dev $OUT protocol ip parent 1:0 handle 7 fw flowid 1:70

# FTP
iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 20,21 -j MARK --set-mark 8
tc filter add dev $OUT protocol ip parent 1:0 handle 8 fw flowid 1:80

# EMULE
iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 4662 -j MARK --set-mark 9
tc filter add dev $OUT protocol ip parent 1:0 handle 9 fw flowid 1:90
iptables -t mangle -A PREROUTING -p udp -i $OUT --dport 4672 -j MARK --set-mark 9
tc filter add dev $OUT protocol ip parent 1:0 handle 9 fw flowid 1:90

# BITTORENT
iptables -t mangle -A PREROUTING -p tcp -i $OUT --dport 6881:6888 -j MARK --set-mark 10
tc filter add dev $OUT protocol ip parent 1:0 handle 10 fw flowid 1:100



Espen
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Scandinavian 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