Forum Discussion

netwerker_31936's avatar
netwerker_31936
Icon for Nimbostratus rankNimbostratus
May 03, 2017

irule to create a hash of source and destination IPs

I have a firewall farm sandwiched between two LTM 4200s running V11.4. The FW VS is 0.0.0.0 all ports [all traffic is LB'd to a FW]. I would like to use persistence based on a single hash value of both the source and destination IP addresses so that each unique source/destination pair persists to a single FW. What would that irule look like?

 

1 Reply

  • Maybe this will work.

    when CLIENT_ACCEPTED {
        scan [IP::client_addr] "%u.%u.%u.%u" a b c d
        scan [IP::local_addr] "%u.%u.%u.%u" e f g h
        set src_dst_hash [ crc32 [ concat $a $b $c $d $e $f $g $h ] ]
        persist hash $src_dst_hash
    }