Freebsd 6.1 traffic shaping problem
Liviu
mlmarius at yahoo.com
Sun Jul 9 09:51:54 UTC 2006
Hello . I have set up traffic shaping for my LAN as follows :
ext_if="rl0"
int_if="rl1"
net_dload_realtime="1Kb"
metro_dload_realtime="10Kb"
net_dload_upperlimit="(512Kb 5000 256Kb)"
metro_dload_upperlimit="50Mb"
scrub in all
altq on $int_if hfsc bandwidth 90Mb queue { ext_download, int_download, def_download }
queue int_download bandwidth 88Mb hfsc(upperlimit 88Mb)
queue def_download bandwidth 64Kb hfsc(default, upperlimit 64Kb)
queue ext_download bandwidth 1Mb hfsc {xd_nake,xd_victor,xd_slash,xd_petre,xd_vera,xd_glontu,xd_razvan,xd_badea\
,xd_bianca,xd_alina,xd_andrei,xd_alecsan,xd_giginelu,xd_valentin,xd_edi,xd_nicu,xd_kaos,xd_virgild13,xd_sebastian\
,xd_flo,xd_gxg,xd_cristian,xd_k2,xd_simona,xd_pig,xd_liviupm,xd_carmen,xd_florin,xd_claudiu,xd_felicia,xd_laurentiu\
,xd_andreiparter,xd_danpm,xd_mari,xd_radud10,xd_adi,xd_gabipm11,xd_slv,xd_alex,xd_john,xd_nicoleta,xd_elena1,xd_aura\
,xd_valipenes,xd_dabulache,xd_fleoarca,xd_bogdand11,xd_traian,xd_georgiana,xd_gabi4,xd_cheyene,xd_dorupm5,xd_picky\
,xd_parterd13,xd_radu,xd_florinflo,xd_alica,xd_elena2,xd_cristid12,xd_gelu,xd_flavius,xd_anamaria}
queue xd_nake bandwidth 10b hfsc(realtime $net_dload_realtime, upperlimit $net_dload_upperlimit)
queue xd_victor bandwidth 10b hfsc(realtime $net_dload_realtime, upperlimit $net_dload_upperlimit)
....... and here are all the other queues ... for download
altq on $ext_if hfsc bandwidth 90Mb queue { ext_upload, int_upload, def_upload }
queue def_upload bandwidth 64Kb hfsc(default, upperlimit 64Kb)
queue int_upload bandwidth 88Mb hfsc(upperlimit 88Mb)
queue ext_upload bandwidth 1Mb hfsc {xu_nake,xu_victor,xu_slash,xu_petre,xu_vera,xu_glontu,xu_razvan,xu_badea,xu_bianca\
,xu_alina,xu_andrei,xu_alecsan,xu_giginelu,xu_valentin,xu_edi,xu_nicu,xu_kaos,xu_virgild13,xu_sebastian,xu_flo,xu_gxg\
,xu_cristian,xu_k2,xu_simona,xu_pig,xu_liviupm,xu_carmen,xu_florin,xu_claudiu,xu_felicia,xu_laurentiu,xu_andreiparter\
,xu_danpm,xu_mari,xu_radud10,xu_adi,xu_gabipm11,xu_slv,xu_alex,xu_john,xu_nicoleta,xu_elena1,xu_aura,xu_valipenes\
,xu_dabulache,xu_fleoarca,xu_bogdand11,xu_traian,xu_georgiana,xu_gabi4,xu_cheyene,xu_dorupm5,xu_picky,xu_parterd13\
,xu_radu,xu_florinflo,xu_alica,xu_elena2,xu_cristid12,xu_gelu,xu_flavius,xu_anamaria}
queue xu_nake bandwidth 10b hfsc(realtime $net_dload_realtime, upperlimit $net_dload_upperlimit)
queue xu_victor bandwidth 10b hfsc(realtime $net_dload_realtime, upperlimit $net_dload_upperlimit)
#.... and here are all the other queues for upload
#at the end of the main pf.conf file i have the redirrection to the queues like this :
pass out quick on $int_if from <metropolitan> to 89.114.47.0/24 queue int_download
pass out quick on $ext_if from 89.114.47.0/24 to <metropolitan> queue int_upload
anchor extern_download from any to 89.114.47.0/24
anchor extern_upload from 89.114.47.0/24 to any
#metropolitan is a table that i get from my ISP and it contains all the subnets that are in their metropolitan area ( i have 100Mb with those that's why i want to separate )
# i have 2 anchor files that i load manually after i start pfctl -f pf.conf . The anchor files look like this :
# extern_download :
int_if="rl1"
pass out quick on $int_if from any to 89.114.47.2 queue xd_nake
pass out quick on $int_if from any to 89.114.47.5 queue xd_victor
pass out quick on $int_if from any to 89.114.47.6 queue xd_slash
# .... all the other queues go here
#extern_upload :
int_if="rl1"
pass in quick on $int_if from 89.114.47.2 to any queue xu_nake
pass in quick on $int_if from 89.114.47.5 to any queue xu_victor
pass in quick on $int_if from 89.114.47.6 to any queue xu_slash
#.... all the other queues go here
As you can see i have a queue in witch all the metropolitan traffic goes ( indifferent of the client that the traffic belongs to ) and separate extern queues for eatch client .
The problem is :
When i first start my home computer and attempt to download from extern , apparently the limitations don't work for a few secconds . ( i can get up the 1Mb download from com while my max queue limit is set up to 512Kb ) . After a few secconds my download rate from extern drops to 0 and it stays that way for another few secconds . After that traffic resumes as intended ( with the limitations that I want ) .
? My question is : how do i make it allocate the right bandwidth from the start ?
Some observations :
- i have had to modify the queue limit in file altq_hfsc.h because i wasn't able to create more than 64 queues at fisrst
#define HFSC_MAX_CLASSES 512
- i am not doing any kind of NAT
- even when i exceed my upperlimit the traffic goes to the right queue because i am looking with pftop ( the 8 view witch shows the dequeue rate of my queues ) and i see that my queue is dequeueing at a rate higher than the rate that i've set up )
---------------------------------
How low will we go? Check out Yahoo! Messengers low PC-to-Phone call rates.
More information about the freebsd-isp
mailing list