[FreeBSD & ipfw2] Fair queueing in combinatie met natd.

Pagina: 1
Acties:

  • raphidae
  • Registratie: Februari 2001
  • Laatst online: 06-01-2025

raphidae

...antichrist...

Topicstarter
Ik ben nu een tijdje aan het prutsen, maar het wil niet erg lukken.

Op een routertje hier heb ik natd en ipfw draaien. Ipfw divert netjes naar natd en dat werkt verder prima.

Nou is het probleem dat als iemand hier gaat uploaden dat meteen de hele upstream vol zit en de verbindingen van anderen traag worden als dikke stront.

Ik wil dus fair queueing met DUMMYNET gaan gebruiken om de bandbreedte netjes te verdelen, maar de upstream lijkt nog steeds ongelimiteerd voor de clients.

Misschien dat iemand hier me kan vertellen waar het misgaat?

De NAT clients zitten op 172.16.0.0/16, de externe adapter is xl0 en de interne is em0.

Ik heb ervoor gekozen om de clients ingaand te limiten, want uitgaand is het IP adres al vertaald door natd.

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
disable one_pass

#incoming bandwidth
pipe 1 config bw 2048kbits/s

#outgoing bandwidth
pipe 2 config bw 2048kbits/s

queue 1 config pipe 1 weight 99 mask dst-ip 0xffffffff #ssh, telnet, ntp
queue 2 config pipe 1 weight 1 mask dst-ip 0xffffffff #all other ip

queue 4 config pipe 2 weight 99 mask src-ip 0xffffffff
queue 5 config pipe 2 weight 1 mask src-ip 0xffffffff


add 00100 allow ip from any to any via lo0

add 01000 divert natd ip from any to me in via xl0
add 01001 check-state

add queue 1 ip from not 172.16.0.0/16 to 172.16.0.0/16 ssh,telnet,ntp out xmit em0
add queue 2 ip from not 172.16.0.0/16 to 172.16.0.0/16 not ssh,telnet,ntp out xmit em0
add queue 1 icmp from not 172.16.0.0/16 to 172.16.0.0/16 out xmit em0


add queue 4 ip from 172.16.0.0/16 to not 172.16.0.0/16 ssh,telnet,ntp in recv em0
add queue 5 ip from 172.16.0.0/16 to not 172.16.0.0/16 not ssh,telnet,ntp in recv em0
add queue 4 icmp from 172.16.0.0/16 to not 172.16.0.0/16 in recv em0


add 04000 allow ip from 172.16.0.0/16 to me via em0 setup keep-state
add 04001 allow icmp from 172.16.0.0/16 to me in via em0
 
add 04109 skipto 61000 ip from 172.16.0.0/16 to any in via em0 keep-state

add 61000 divert natd ip from 172.16.0.0/16 to any out via xl0
add 61001 allow ip from any to any

Every morning is the dawn of a new error.


  • vso
  • Registratie: Augustus 2001
  • Niet online

vso

tja...

heb je een SDSL lijn of een ADSL/kabel want voor zowel up als voor down-stream gebruik je 2048 (2Mbit) config .. ik vraag me af of dat klopt ten eerste


dus 2048/2048 ipv 2048/512 of zo daarnaast ze ik niet veel "scheidingen" tussen de pipes ...

fair Queueing gebruik je toch om het 1ne verkeer toch wat meer "voorrang" tegeven dan de andere ?

[ Voor 38% gewijzigd door vso op 14-06-2004 16:44 ]

Tja vanalles


  • raphidae
  • Registratie: Februari 2001
  • Laatst online: 06-01-2025

raphidae

...antichrist...

Topicstarter
vso schreef op 14 juni 2004 @ 16:42:
heb je een SDSL lijn of een ADSL/kabel want voor zowel up als voor down-stream gebruik je 2048 (2Mbit) config .. ik vraag me af of dat klopt ten eerste


dus 2048/2048 ipv 2048/512 of zo daarnaast ze ik niet veel "scheidingen" tussen de pipes ...

fair Queueing gebruik je toch om het 1ne verkeer toch wat meer "voorrang" tegeven dan de andere ?
Het is 2mbit sdsl.

De bedoeling is dat er twee dingen gebeuren:

-Dat de 2Mbit netjes verdeeld wordt per client, dus als 1 client wat upload heeft ie de volle bandbreedte, maar als dan iemand anders wat wil uploaden krijgen ze allebei de helft, en met drie allemaal een derde, etc. Dit doe ik door de traffic van alle clients in dezelfde queue te gooien met mask 0xffffffff, dat zou alles netjes per IP moeten verdelen.

-Dat ssh, telnet en ntp verkeer altijd voorrang heeft op ander verkeer (ftp, http etc.) Dit verkeer gaat in een andere queue die een grotere weight heeft en dus voorrang heeft bij de pipe.

Every morning is the dawn of a new error.


  • vso
  • Registratie: Augustus 2001
  • Niet online

vso

tja...

ik zou als ik jou was eerst eens gaan testen met bv FTP test voor 1 sessie voor 1 pipe zodat je het doorhebt

dus "van <---> naar" verkeer genereneren bv met behulp van ftp en dat 1ne protocol zien te kunnen manupuleren met namen dan waar het jou om gaat de snelheid vervolgens de test te doen op 2 pc's.
lukt dit de test wijzigen door op 1 pc een gigabyte te gaan up/downloaden ofzo en dan simultaan op een andere pc een ssh, rdp of vnc te laten lopen die dus geen hinder ondervind van je ftp-transfer.

als je dat lukt lijkt me de rest ombouwen een peace of cookie.

Tja vanalles


  • raphidae
  • Registratie: Februari 2001
  • Laatst online: 06-01-2025

raphidae

...antichrist...

Topicstarter
Het is gelukt, ik post hier ff mijn ruleset voor mensen die er later op zoeken:

code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#incoming bandwidth
pipe 1 config bw 2048kbits/s queue 1Kbytes

#outgoing bandwidth
pipe 2 config bw 2048kbits/s queue 1Kbytes

#incoming queues, group on dst-host
queue 10 config pipe 1 weight 50 mask dst-ip 0xffffffff #icmp
queue 11 config pipe 1 weight 99 mask dst-ip 0xffffffff #ssh, telnet, dns
queue 12 config pipe 1 weight 40 mask dst-ip 0xffffffff #all other ip

#outgoing queues, group on src-host
queue 20 config pipe 2 weight 50 mask src-ip 0xffffffff #icmp
queue 21 config pipe 2 weight 99 mask src-ip 0xffffffff #ssh, telnet, dns
queue 22 config pipe 2 weight 40 mask src-ip 0xffffffff #all other ip

#queues for local system
queue 30 config pipe 1 weight 50 mask dst-ip 0xffffffff
queue 31 config pipe 2 weight 50 mask src-ip 0xffffffff

#allow traffic on loopback interface
add 00100 allow ip from any to any via lo0

#deny packets to the loopback addresses on any other interface, return host unreach
add 00110 unreach host log logamount 20 ip from any to 127.0.0.0/8 via any


#deny complete private address space at bridge
add 00301 unreach host log logamount 20 ip from 10.0.0.0/8 to any via any
add 00302 unreach host log logamount 20 ip from 172.16.0.0/12 to any via any
add 00303 unreach host log logamount 20 ip from 192.168.0.0/16 to any via any

#deny packets in to addresses not on the inside, return host unreach
add 00501 unreach host log logamount 100 ip from any to not $INTERNALNET in recv xl1

#for bridged traffic, skip
add skipto 19000 ip from any to any via any bridged

  #deny packets with a source address known on a wrong interface, return host unreach
  add 00800 unreach host log logamount 20 ip from any to any not verrevpath in

  # for non-bridged traffic, skip
  add skipto 30000 ip from any to any via any

#only bridged packets come here
add 19000 check-state

  #deny windows networking, return RST
  add 19100 reset log logamount 20 ip from any to any 135,137-139 via any

  #deny windows DCOM/MsTask/scvhost undocumented crap-o-rama
  add 19110 reset log logamount 20 ip from any to any 1024-1030 in recv xl1

  #deny raw printing 
  add 19120 reset log logamount 20 ip from any to any 9100 in recv xl1

  #queues for bridged traffic
  add 20000 queue 10 icmp from any to any in recv xl1
  add 20100 queue 11 ip from any 22,23,53,80 to any in recv xl1 
  add 20200 queue 11 ip from any to any 22,23,53,80 in recv xl1
  add 20300 queue 12 ip from any to any in recv xl1

  add 21000 queue 20 icmp from any to any in recv xl0
  add 21100 queue 21 ip from any to any 22,23,53,80 in recv xl0
  add 21200 queue 21 ip from any 22,23,53,80 to any in recv xl0
  add 21300 queue 22 ip from any to any in recv xl0

  #nothing should come here, log and skip to end
  add skipto 50000 log logamount 20 ip from any to any via any

#only non-bridged packets come here
add 30000 check-state

  #queues for local system
  add 31000 queue 30 icmp from any to any in recv xl1
  add 31100 queue 30 ip from any to any in recv xl1

  add 32000 queue 31 icmp from any to any out xmit xl1
  add 32100 queue 31 ip from any to any out xmit xl1

#end
add 50000 pass all from any to any

Every morning is the dawn of a new error.


  • vso
  • Registratie: Augustus 2001
  • Niet online

vso

tja...

hey stoer !!! thx scheelt een hoop werk ;)

Tja vanalles

Pagina: 1