Tuesday, December 16, 2008

Decode BigIP cookie to identify pool member

How to decode BigIP LTM cookie to identify which pool member (web server IP) the request is routed to?
---------------------------------------------------------------------

HTTP headers in a transaction will have the BIGIP cookie information as below.

Cookie: BIGipServer{pool-name}-80=404007104.20480.0000

404007104 is the encoded IP address of a pool member
20480 is the encoded port number

IP address encoding
------------------

If the IP address is of format a.b.c.d, it is encoded as
d*256^3 + c*256^2 + b*256 +a

For example, IP address 192.168.20.24 is encoded as
24*256^3+20*256^2+168*256+192 = 404007104

Port encoding
----------

The port is encoded by taking the two bytes that store the port and reversing them

Port 80 is encoded as 80 * 256 + 0 = 20480
Port 443 is encoded as 443 * 256 + 0 = 113408

No comments: