NetScaler - LB vserver type any - filter for both TCP and UDP Ports

NetScaler - LB vserver type any - filter for both TCP and UDP Ports

book

Article ID: CTX230203

calendar_today

Updated On:

Description

Create a lb vserver of type any, then add a filter for specific UDP and TCP ports.

Adding the next listen policy makes DNS to work, but HTTPs to fail:
 set  lb vserver Any175 -Listenpolicy "CLIENT.UDP.DSTPORT.EQ(53)||CLIENT.TCP.DSTPORT.EQ(443)" 
    
Adding the next listen policy makes HTTPs to work but DNS to fail:
set  lb vserver Any175 -Listenpolicy "CLIENT.TCP.DSTPORT.EQ(443)||CLIENT.UDP.DSTPORT.EQ(53)" 
    
    Then the HTTPs request works fine, but the DNS gets a timeout.

 


Instructions

When evaluating mixed TCP-UDP traffic on a lb vserver of type any, an exception will be generated if trying to read a UDP port on TCP traffic, or vice-versa. The proposed filter will check first for protocol type, then, if protocol is UDP will try to match UDP ports, or if protocol is TCP will try to match TCP ports. Making the port consult reliable for either protocol. For instance:

set  lb vserver Any175 -Listenpolicy "(CLIENT.IP.PROTOCOL.EQ(TCP)&&(CLIENT.TCP.DSTPORT.EQ(445)||CLIENT.TCP.DSTPORT.EQ(444))) || (CLIENT.IP.PROTOCOL.EQ(UDP)&&(CLIENT.UDP.DSTPORT.EQ(52)||CLIENT.UDP.DSTPORT.EQ(54)))"

( In an AND expression, if the first arguments evaluate to false, then the rest of the arguments are not evaluated. as we are defining protocol=TCP as first argument, the expression will not try to evaluate TCP ports on non TCP packets)