Forum Discussion

ant77's avatar
ant77
Icon for Cirrostratus rankCirrostratus
Mar 09, 2021

Universal persistence using IPV6 with iRule..

Hello everyone and F5,

 

please help....I am stuck and don’t know what to do or if F5 can support this...

 

Does anyone know how to persist an IPV6 address in an X-forwarded-for header, or add it to the current code below? We are currently calling

this i-Rule with universal persistence profile, however it seems to only work if the user's client IP is in IPV4 format. If they get an IPV6 address from

their ISP provider, the persistency does not work even though our CDN address their IPV6 in the XFF header field.

 

Any help is much appreciated!

 

 

when HTTP_REQUEST { 
    if {[HTTP::header X-Forwarded-For] != ""} then {
        persist uie [lindex [ split [lindex [HTTP::header values X-Forwarded-For] 0] "," ] 0]
    } else {
persist uie [IP::client_addr]
    }
}

 

  • Do you have a persistence profile on the virtual? Might be best to have a default of source_addr persistence as a profile on the virtual, that way you can reduce your iRule to this (my attempt, you'll need to test)

    when HTTP_REQUEST {
      if { [HTTP::header exists X-Forwarded-For] } {
        persist uie [getfield [HTTP::header X-Forwarded-For] "," 1]
      }
    }
    • ant77's avatar
      ant77
      Icon for Cirrostratus rankCirrostratus

      Hi Jason,

       

      We can't use a default source_addr profile because the inbound traffic goes through a CDN, which they append the client IP and their proxy IP to the XFF header. We use the irule to look into this and persist the connection for the client to a server in the backend. This works fine with IPV4, however there are instances where some of our user's ISP is giving them an IPV6 address. How can this iRule or any other method be used to read the IPV6 along with the IPV4 (this irule) and persist the client

      based on that?

       

      Thanks!

      • ant77's avatar
        ant77
        Icon for Cirrostratus rankCirrostratus

        Hello F5/Jason,

         

        Please help...can you let me know if this can be done or not?

         

        Thanks!