This article describes how to enable client IP in TCP/IP option of NetScaler.
Currently, several customers are trying to make use of the NetScaler as a centralized resource to perform load balancing for many applications in large data centers. When NetScaler application switch is used as >= L3 switch, it is setup as a proxy as many servers are across an L3 network. We need to operate as a proxy for such environments, however this results in the loss of the client’s source IP. As a result, we need to insert the client’s connection information as part of the initial data stream.
For HTTP and SSL services this is done by inserting ClientIP address as HTTP Header on the request to the server. Inserting Client IP address header is not possible for TCP based services . So we can use TCP header insertion as an alternative.
This drawback is solved by this feature. After the three way handshake with the server, a single packet of additional data will be sent to the server. This data will be prepended with the 32 bit binary representation of the value entered as the CIP header, and then the complete TCP/IP header information for the packet that induced the backend connection to be established. This data starts with the start of the IP header to the end of the TCP header, including IPv6 extension headers, IPv4 options, and TCP options as appropriate. As such, proper logic in the application will need to be incorporated to ensure that the proper fields are being parsed.
Note that this feature does not work on HTTP load balancing virtual server/service.
An extra packet is sent by the NetScaler to the server side containing the following information
- Variable length: Client side session information, it is a copy of final acknowledgement packet used in client side connection establishment (only header).
- IPV6: Basic IPv6 header is copied to the server side as it is. NetScaler does not have dual IPv6 stack rather it converts IPv6 packet to IPv4 and Layer 3 and after upper layers processes the packet. Again the packet is translated from IPv4 to IPv6. While converting original IPv6 header to IPv4 for TCP level proxing all extension headers are ignored. But for TCP CIP, we copy the original IPv6 basic header and forward to the server side.
Screen shots of sample trace
Note: In SSL_BRIDGE NetScaler TCP does not proxy the final packet from client to the server side. On the final ACK, protocol control block (PCB, TCP session structure) itself is not created on the NetScaler. We do this because we know that this is an SSL protocol and client has to send first data packet (SSL client hello), only then PCB is allocated on NetScaler for the client side connection and IP+TCP header is stored from this client hello packet and forwarded to the sever side and client side information. If suppose client hello may be 265 bytes, so we will see the IP len as 265 bytes.
In our Lab we successfully tested this feature for following services:
- TCP service
- SSL_BRIDGE service
- SSL_TCP service