Forum Discussion

Dormelchen_2406's avatar
Dormelchen_2406
Icon for Nimbostratus rankNimbostratus
Aug 15, 2014

GeoIP Irule - what to do

hello together,

 

we have an virtual server with his irule. Now we only want to allow access to this pool / server from poland and germany.

 

1) how can i solve this ? 2) the irule:

 

when HTTP_REQUEST { set lowerURI [string tolower [HTTP::uri]] switch [HTTP::host] { "www.xxxx.com" { 'a lot of if / elseif questions if starts with -> use pool etc) ' and the last else: else { pool www_xxxx_com_80 if {$debug}{log local0. "WEB: Client: [IP::client_addr]:[TCP::client_port] LB to: [LB::server addr]"} return} } } }

 

Could someone help me ? And did i have to configure something before on our BigIP to get GEO IP Filter to run ?

 

We have an 5200 with BIG-IP 11.5.1 Build 3.0.131 Hotfix HF3

 

3 Replies

  • maybe this ?

        when CLIENT_ACCEPTED {  
    if {not ([whereis [IP::client_addr] country] eq "DE" or "PL")}{  
    reject  
    }  
    }  
    when HTTP_REQUEST {  
    set lowerURI [string tolower [HTTP::uri]]  
    switch [HTTP::host] {  
    "www.xxxx.com" {   
    

    ?

  • I don't think 'if' will work like that but you have the right idea about using CLIENT_ACCEPTED. Try - this - 'if' would work too, but I just like 'switch';-

    when CLIENT_ACCEPTED {
       switch [whereis [IP::client_addr] country] {
          "DE" -
          "PL" {
              Allowed countries - do nothing
          }
          default {
             reject
          }
       }
    }
    
  • is there any possibility to add an FQDN to the rule ?

     

    like DE and PL are allowed AND for example FQDN www.google.de ?

     

    thanks