Forum Discussion

breizho35_11667's avatar
breizho35_11667
Icon for Nimbostratus rankNimbostratus
Jan 07, 2016

Persistence based on source tcp/udp port

Hello,

 

Is is possible to configure persistence based on source tcp/udp port ? How can I do that ?

 

Thanks and regards.

 

Eric

 

6 Replies

  • BinaryCanary_19's avatar
    BinaryCanary_19
    Historic F5 Account

    Using Universal Persistence , you should be able to persist on anything your irules can lay their hands on, and you can easily grab source port.

     

    Why you would want to persist on source port is a mystery to me, but I will assume that you have thought it through.

     

  • BinaryCanary_19's avatar
    BinaryCanary_19
    Historic F5 Account

    Yes. The idea of Universal Persistence is so that you can write your own logic, if the system-supplied persistence criteria don't meet your needs.

    The example on the solution article for universal persistence is extracting the key from a cookie value. In your case, you will be using source port instead of JSESSIONID cookie.

    The idea is generally (pseudocode):

     when CLIENT_ACCEPTED:
       persist uie [TCP::client_port]
    
    
     when SERVER_CONNECTED:
       persist add uie [TCP::client_port]
    

    Logic is a little simpler since the port is always present. YOu of course need to test this.

  • Hi, it seems ok for the TCP persistence, it works fine, Thanks ! I used this Irule: when CLIENT_ACCEPTED { persist uie [TCP::client_port] }

     

    when SERVER_CONNECTED { persist add uie [TCP::client_port] }

     

    How can I include a TIMEOUT parameter for each persistence ? How can I combine TCP and UDP persistence ? Is the following is ok ? when CLIENT_ACCEPTED { persist uie [TCP::client_port] persist uie [UDP::client_port] }

     

    when SERVER_CONNECTED { persist add uie [TCP::client_port] persist add uie [UDP::client_port] }

     

    Thanks and regards. Eric