Автор Тема: PF може ли да мачва по TOS?  (Прочетена 1350 пъти)

ivanatora

  • Напреднали
  • *****
  • Публикации: 658
  • Distribution: Ubuntu 10.04
  • Window Manager: Fluxbox
    • Профил
    • WWW
PF може ли да мачва по TOS?
« -: Feb 15, 2009, 11:35 »
Здравейте,
Опитвам се да направя QoS според специфична TOS стойност в хедъра на ИП пакетите, но изглежда не мога да направя PF правило, което да match-ва тази стойност. В tcpdump виждам че пакети с тази стойност все пак има:
Код:
13:38:35.466787 IP (tos 0x30, ttl 64, id 0, offset 0, flags [DF], proto TCP (6), length 40) 192.168.0.34.47624 > 67.225.240.104.80: R, cksum 0xf6f5 (correct), 1916966715:1916966715(0) win 0
Ето ми го pf.conf:
Код:
### Macros
int_if = "re0"
ext_if = "rl0"
ext_ip = "192.168.1.2"
### Tables
table <network>  { 192.168.0.34, 192.168.0.9 }
### Options
set state-policy if-bound
### Normalizations
scrub in all

### Queueing
altq on $int_if hfsc bandwidth 15Mb queue {download, gen_down, dl_int}
queue gen_down bandwidth 1Mb hfsc (realtime 1Mb upperlimit 1Mb default)
queue download bandwidth 12Mb hfsc (realtime 10Mb upperlimit 15Mb)
queue dl_int bandwidth 2Mb hfsc (realtime 1Mb upperlimit 2Mb)

altq on $ext_if hfsc bandwidth 15Mb queue {upload, gen_up, up_int}
queue gen_up bandwidth 1Mb hfsc (realtime 1Mb upperlimit 1Mb)
queue upload bandwidth 12Mb hfsc (realtime 10Mb upperlimit 15Mb default)
queue up_int bandwidth 2Mb hfsc (realtime 1Mb upperlimit 2Mb)

### Translation
#nat on $ext_if tagged DO_NAT -> $ext_ip
nat on $ext_if from <network> to any -> $ext_ip
rdr on $ext_if proto tcp from any to any port 225 -> 192.168.0.34
rdr on $ext_if proto tcp from any to any port 456 -> 192.168.0.34 port 80

### Filtering
pass quick on $int_if from <network> tos 0x30 label "int_dl" #queue dl_int
pass log (all to pflog0) quick on $int_if from <network> keep state tag to_data label "?download:" queue download
pass log (all to pflog1) quick on $ext_if tagged to_data label "?upload:" queue upload
В правилото за tos 0x30 пробвах да разменя $ext_if -> $int_if както и "from <network>" с "to <network>", защото имам свойството да се обърквам с посоките. В никой от случаите не успях да match-на пакетите.
Някакви идеи?
« Последна редакция: Feb 15, 2009, 13:33 от ivanatora »
Активен