Страница 1 из 1
mpd+ipfw(shape)+pf(nat)
Добавлено: 2007-07-09 14:56:53
plohish
Задача: шейпить пользователей vpn, который организован при помощи mpd-4.1. При помощи pf не получается. Решил использовать ipfw pipe. Собрал ядро с
options IPFIREWALL
options IPFIREWALL_DEFAULT_TO_ACCEPT
options DUMMYNET
options HZ=1000
Конфиг:
${ipfw} add pipe 1 ip from 10.19.82.25:255.255.255.255 to any
${ipfw} add pipe 2 ip from any to 10.19.82.25:255.255.255.255
${ipfw} pipe 1 config bw 128Kbit/s queue 10
${ipfw} pipe 2 config bw 128Kbit/s queue 10
Т.е. должна работать схема client -> mpd -> ipfw (shape) -> pf (nat).
Работают только пинги.

Хотя если ходить из локалки все прекрасно и шейпится и натится.. А вот с впн только пинговать можно...
Кто сталкивался ?
Добавлено: 2007-07-09 16:03:59
plohish
Решено.
${ipfw} add pipe 1 ip from 10.19.82.25:255.255.255.255 to any in
${ipfw} add pipe 2 ip from any to 10.19.82.25:255.255.255.255 out
Дело вот в этих "in", "out". Я ipfw не пользовался никогда, с синтаксисом не особо..
Добавлено: 2007-07-09 16:28:29
Dog
А можно узнать почему не сложилось с pf? Какие были действия и что получилось в результате? Просто интересно.
Добавлено: 2007-07-13 16:53:46
schizoid
а кто-нить пыталсяна нарезать скорость словарем радиусным?
типа:
Код: Выделить всё
RADIUS ACL's
Mpd can use the Access Control Lists (ACLs) taken from the RADIUS server. This ACLs may include ipfw rules, pipes, queues and tables and also mpd internal traffic filtering/shaping/limiting features. That two sets are redundant. ipfw proposed as standard and universal solution, while internal filter/shaper/limiter expected to work faster with big number of active links.
To use this feature you should add to your RADIUS server such dictionary:
#----------------------------------------------------------
# dictionary.mpd
VENDOR mpd 12341
ATTRIBUTE mpd-rule 1 string mpd
ATTRIBUTE mpd-pipe 2 string mpd
ATTRIBUTE mpd-queue 3 string mpd
ATTRIBUTE mpd-table 4 string mpd
ATTRIBUTE mpd-table-static 5 string mpd
ATTRIBUTE mpd-filter 6 string mpd
ATTRIBUTE mpd-limit 7 string mpd
#----------------------------------------------------------
ipfw
You can write in your RADIUS configuration something like:
mpd-table += "1=10.0.0.1",
mpd-table += "1=10.0.0.15",
mpd-pipe += "1=bw 10Kbyte/s",
mpd-pipe += "5=bw 20Kbyte/s",
mpd-rule += "1=pipe %p1 all from any to table(%t1) in",
mpd-rule += "2=pipe %p5 all from table(%t1) to any out",
mpd-rule += "100=allow all from any to any",
When mpd receives these parameters it will call ipfw(8) to create firewall rules, pipes and queues with unique numbers starting from 10000 (configurable via 'set global start...'). To the end of each rule will be added "via ngX" to make the rule apply only to that client's networking interface.
As a result of this example we would get these commands executed:
ipfw table 32 add 10.0.0.1
ipfw table 32 add 10.0.0.15
ipfw pipe 10000 config bw 10Kbyte/s
ipfw pipe 10001 config bw 20Kbyte/s
ipfw add 10000 pipe 10000 all from any to table(32) in via ng0
ipfw add 10001 pipe 10001 all from table(32) to any out via ng0
ipfw add 10002 allow all from any to any via ng0
When the link goes down, all created rules will be removed.