Forum Discussion
Brian_Mayer_841
Nimbostratus
Nov 05, 2007Restrict access to Virtual Servers based on IP address
Hi all,
We have some test sites going online soon and need them to be publicly accessible for some external testers. But we don't want the entire world to see the sites until they're ready ...
hoolio
Cirrostratus
Nov 07, 2007The previous example will work for a virtual server with a pool, where you want traffic from allowed clients to be load balanced and other clients to be dropped. Here is a shortened version that drops all requests if the client IP is not part of the datagroup.
this event is triggered when a client - BIG-IP TCP connection is established
when CLIENT_ACCEPTED {
Check if the client IP is not part of the datagroup hosts/networks
if { not ([matchclass [IP::client_addr] equals $::allowed_clients_datagroup]) }{
Log dropped requests
log local0. "Invalid client IP: [IP::client_addr] - discarding"
drop the request
discard
}
}If you created a class/datagroup with a different name, just update the rule to reference the name you used.
If this doesn't work for you, check the ltm log file via the command line (tail -f /var/log/ltm) and see if you get any log statements showing errors.
Aaron
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects