aschi
Dec 02, 2015Nimbostratus
Assign a Pool regarding to the Destination Port.
I need to assign a Pool regarding to the Destination Port. I found different Solutions and would like to ask what the best solution would be.
Solution1:
when CLIENT_ACCEPTED {
if { [TCP::local_port] < 30000 or [TCP::local_port] > 30050} {
pool Poola
if { [TCP::local_port] eq 22} {
pool Poolb
}
} else { drop }
}
If I could specify a Pool like pool_[TCP::local_port] for each of the Ports between 30000 and 30050 than I wouldn't have to use nested if. But I have to specify 50 different Pools. Is there a way to optimize this?
Solution2:
when CLIENT_ACCEPTED {
switch [TCP::local_port] {
"30000" { pool Poola }
...
...
"30050" { pool Poola }
"22" { pool Poolb }
default { drop }
}
}
Would it be possibe to use a Portrange in solution 2 that I don't have to add 50 lines for each Port?
In my Optinion is Solution1 the one I should go for. Best Regards, Roger