Forum Discussion
Virtual Server multiple service ports
I am new to F5 devices and load balancers in general, only having limited exposure to some Foundry devices until now. I am curious about what I've read and seen thus far about creating a virtual server and the ports it will allow connections on. Do I really need to create a new virtual server for each port that I want available or am I overlooking something and creating more work for myself?
Thanks,
DarkSide
35 Replies
- hoolio
Cirrostratus
You can configure a VIP on port 0 (any port) and then use an iRule or IP filters to restrict which destination ports can be used. Here is an example iRule which drops requests outside of a range of ports:when CLIENT_ACCEPTED { Check if requested port is outside 1000 - 2000 if { [TCP::client_port] < 1000 or [TCP::client_port] > 2000}{ Drop request drop } }
- In general the LTM is default-deny device, so yes if you do not configure a virtual for each port you need then the traffic will be blocked. That being said, you can create virtuals and pools on port 0 (any port). That will allow all ports to communicate on that virtual.
- DarkSideOfTheQ_
Nimbostratus
Aaron - I am just begining to learn the iRules and have only created simple HTTP/HTTPS redirects thus far. Your example sounds interesting and I'll have to play around some. - hoolio
Cirrostratus
If it's only a few ports and the protocol isn't the same, I agree with Denny that it's better to configure individual VIPs. As he suggested, this allows you to configure protocol-specific profiles and tweak the settings according to the protocol. The port range option is better if it's a lot of ports--particularly if it's the same protocol. - Josh_41258
Nimbostratus
Sorry for the bump, but could someone help me out with the proper syntax for something like:when CLIENT_ACCEPTED { Check if requested port is outside 1000 - 2000 if { [TCP::client_port] < 1000 or [TCP::client_port] > 2000 or [TCP::client_port] not 3389 or [TCP::client_port] not 1500 or [TCP::client_port] not 161 }{ Drop request drop }
- hoolio
Cirrostratus
Hi Josh,when CLIENT_ACCEPTED { Check if requested port is outside 1000 - 2000 if { not (([TCP::local_port] > 1000 and [TCP::local_port] < 2000) or [TCP::local_port] == 3389 or [TCP::local_port] == 1500 or [TCP::local_port] == 161) }{ Drop request drop } }
- Dilip_bhapkar06
Nimbostratus
Hi ,I am just begin to learn F5 device.I want to open 7 ports ( Mail Related) in F5 for same virtual Server. - using port zero will listen for all ports, then you could use a switch statement to handle the ports you want with a default condition of discard.
- kamals_48971
Nimbostratus
but if I have to allow different range of address like 19000-20000 and 30000 - 30999 then I tried this but now sure if it is correct b rule tcp_port '{ when CLIENT_ACCEPTED { Check if requested port is outside 18000 - 20999 ,30000 - 30999 if { [TCP::client_port] < 19000 or [TCP::client_port] < 30000 or [TCP::client_port] > 20999 or [TCP::client_port] > 30999
}{
Drop request drop }
} }'
is it source port (client port) or destination port (virtual server port)? if it is destination, it is TCP::local_port.
when CLIENT_ACCEPTED { Check if requested port is outside 18000 - 20999, 30000 - 30999 if { not ( [TCP::local_port] >= 18000 and [TCP::local_port] <= 20999 ) and not ( [TCP::local_port] >= 30000 and [TCP::local_port] <= 30999 ) } { Drop request drop } }
TCP::local_port
https://devcentral.f5.com/wiki/iRules.tcp__local_port.ashx
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com