Forum Discussion
mbamusa_59409
Nimbostratus
Jan 24, 2012Restrict Access based on country using LTM or ASM
hi all;
could you please help me to find a way to restrict access to virtual server for some countries using irule and GEOLocation Data Base .
thank you
Mbamusa
9 Replies
Sort By
- frank_30469
Nimbostratus
Hello, - Arie
Altostratus
mbamusa, can you work with Frank's answer or do you need additional information and/or help? - mbamusa_59409
Nimbostratus
thank you Frank and Arie for the support , but could you please provide me an example (i.e. restrict access comes from China and Russia ) - hoolio
Cirrostratus
Here's a positive example:when CLIENT_ACCEPTED { Get the country client IP switch [whereis [IP::client_addr] country] { US - CA - MX { set allowed 1 } default { set allowed 0 } } } when HTTP_REQUEST { if {$allowed == 0}{ HTTP::respond 403 content {Blocked!} } }
when CLIENT_ACCEPTED { Get the country client IP switch [whereis [IP::client_addr] country] { "CN" - "RU" { set allowed 0 } default { set allowed 1 } } } when HTTP_REQUEST { if {$allowed == 0}{ HTTP::respond 403 content {Blocked!} } }
when CLIENT_ACCEPTED { Get the country client IP switch [whereis [IP::client_addr] country] { "CN" - "RU" { Reset the TCP connection reject } } }
- nitass
Employee
can you try this?[root@ve1023:Active] config b rule myrule list rule myrule { when CLIENT_ACCEPTED { switch [whereis [IP::client_addr] country] { CN - RU { drop } default { do something else } } } }
- nitass
Employee
oops! my page was not updated. Aaron's one is nicer. please follow his. :-) - mbamusa_59409
Nimbostratus
Thank You All for your kind Support , i'll Try the IRule and I'll get back to you with the result . - mbamusa_59409
Nimbostratus
Dear All; - Vijith_182946
Cirrostratus
I think iRule take a lots of resources, you should try the ASM geolocation feature before u make up your mind on iRule. The detailed write is here.
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