Altq?

Mr. BBQ

Der Wurstfachverkäuferin
Ich bin grad am konfigurieren meiner pf.conf. derzeit läuft alles recht fein und ich möchte mit altq meine bandbreite kontrollieren. ein freund von mir zahlt nämlich an der leitung mit und ich möchte ihm die hälfte der bandbreite garantieren. dazu verwende ich altq. die downloadgeschwindigkeit ist schon richtig eingestellt und jetzt möcht ich noch den upload kontrollieren. dazu hab ich das erste beispiel von der OpenBSD FAQ genommen http://www.openbsd.org/faq/pf/queueing.html.
ich hab nun ein paar zeilen hinzugefügt mit der der Upload auf 100kbit begrenzt sein soll. aber es scheint so als würden diese nicht beachtet werden. an was kann das liegen?

Code:
# our defines
ext_if="ppp0"
int_if="rl1"
if_to_ext_if="rl0"

unroutable="{ 127.0.0.1/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 255.255.255.255/32 }"

internal_net="192.168.1.0/24"

# force packets to conform to specifications.  You can miss off the
# no-df if you don't intend to use IPSec.
scrub in  all no-df
scrub out all no-df

#nat on $ext_if from $internal_net to any -> $ext_if

# enable queueing on the external interface to control traffic going to
# the Internet. use the priq scheduler to control only priorities. set
# the bandwidth to ~256Kbps to get the best performance out of the TCP
# ACK queue.

altq on $ext_if cbq bandwidth 200Kb queue { std_out, ssh_im_out, dns_out, tcp_ack_out, [COLOR=DarkRed]clemens_out [/COLOR] }

# define the parameters for the child queues.
# std_out      - the standard queue. any filter rule below that does not
#                explicitly specify a queue will have its traffic added
#                to this queue.
# ssh_im_out   - interactive SSH and various instant message traffic.
# dns_out      - DNS queries.
# tcp_ack_out  - TCP ACK packets with no data payload.

queue std_out           cbq(default)
queue ssh_im_out        priority 4 cbq
queue dns_out           priority 5
queue tcp_ack_out       priority 6
[COLOR=DarkRed]queue clemens_out       bandwidth 100Kb cbq[/COLOR]

# enable queueing on the internal interface to control traffic coming in
# from the Internet. use the cbq scheduler to control bandwidth. max
# bandwidth is ~768Mbps.

altq on $int_if cbq bandwidth 750Kb queue { std_in, ssh_im_in, dns_in, clemens_in }

# define the parameters for the child queues.
# std_in      - the standard queue. any filter rule below that does not
#               explicitly specify a queue will have its traffic added
#               to this queue.
# ssh_im_in   - interactive SSH and various instant message traffic.
# dns_in      - DNS replies.
# clemens_in  - bandwidth reserved for Clemens' workstation. allow him to
#               borrow.

queue std_in            cbq(default)
queue ssh_im_in         priority 4
queue dns_in            priority 5
queue clemens_in        bandwidth 375Kb cbq

# enable forwarding
nat on $ext_if from $internal_net to any -> $ext_if

# ... in the filtering section of pf.conf ...

karl         = "192.168.1.110"
clemens      = "192.168.1.100"
ssh_ports     = "{ 22 2022 }"
im_ports      = "{ 1863 5190 5222 }"

# filter rules for $ext_if inbound
block in on $ext_if all

# filter rules for $ext_if outbound
block out on $ext_if all
pass  out on $ext_if inet proto tcp from $ext_if to any flags S/SA keep state queue(std_out, tcp_ack_out)
pass  out on $ext_if inet proto { udp icmp } from $ext_if to any keep state
pass  out on $ext_if inet proto { tcp udp } from $ext_if to any port domain keep state queue dns_out
pass  out on $ext_if inet proto tcp from $ext_if to any port $ssh_ports flags S/SA keep state queue(std_out, ssh_im_out)
pass  out on $ext_if inet proto tcp from $ext_if to any port $im_ports flags S/SA keep state queue(ssh_im_out, tcp_ack_out)
[COLOR=DarkRed]pass  out on $ext_if from $clemens to any queue clemens_out[/COLOR]

# filter rules for $int_if inbound
block in on $int_if all
pass  in on $int_if from $internal_net

# filter rules for $int_if outbound
block out on $int_if all
pass  out on $int_if from any to $internal_net
pass  out on $int_if proto { tcp udp } from any port domain to $internal_net queue dns_in
pass  out on $int_if proto tcp from any port $ssh_ports to $internal_net queue(std_in, ssh_im_in)
pass  out on $int_if proto tcp from any port $im_ports to $internal_net queue ssh_im_in
pass  out on $int_if from any to $clemens queue clemens_in
 
Hallo Mr. BBQ

ich habe genau das gleiche Problem mit FTP-Begrenzung. (habs gestern Nacht unter OpenBSD > Netzwerk reingetan. Ich hoffe auch auf Hilfe. Falls du was rausfindest, bitte melden. Ich machs auch bei dir.

Gruss Raphy
 
Wenn es nur beim Upload Probleme gibt, dann liegt es höchstwahrscheinlich an der NAT.

Aus der FAQ:
NOTE: Translated packets must still pass through the filter engine and will be blocked or passed based on the filter rules that have been defined.

Das heißt für mich, dass erst geNATed wird und das ganze Paket dann durch den Filter durch muss. Da sich durch die Übersetzung die Source-Adresse geändert hat, bekommst du auch keinen Match mehr auf $clemens.

In diesem Falle sollte das Queueing auf dem internen Interface für Abhilfe sorgen:
pass in on $int_if from $clemens to any queue clemens_out

MfG
morph

PS @raphaelb: Anhand deiner pf wird mir deine Topologie nicht ganz klar. Der FTP steht wo?
 
danke für deinen tipp. leider hat sich bei meinem netzwerk schon sehr viel verändert und das mit dem altq hab ich fallen lassen.
 
Zurück
Oben