Forum Discussion

JRahm's avatar
JRahm
Icon for Admin rankAdmin
Mar 01, 2005

Terminal Server Persistence

I have msrdp persistence working without a rule, but only within a single vip. Globally, I don't have persistence to the client, so a client could potentially be assigned to the wrong vip, and even though session directory sends the client the routing token, and the client sends this routing token to the BigIP, it is being ignored if the client hits the wrong vip. Here's what the cookie looks like in hex and ascii:

 

 

0040 00 43 6f 6f 6b 69 65 3a 20 6d 73 74 73 3d 38 31 .Cookie: msts=81

 

0050 33 39 36 34 30 34 32 2e 31 35 36 32 39 2e 30 30 3964042.15629.00

 

0060 30 30 0d 0a 00..

 

 

The 813964042 is the server IP (dec->hex(reverse pairs)->dec(by octet)) and the 15629 is the tcp port (dec->hex(reverse pairs)->dec)

 

 

If I can't persist across virtuals with the msrdp cookie with the gui, then I'd like to build a rule that will persist across virtuals. I don't want only one vip because I will have aprox. 750 servers, and I'd like to pool these by rack.

 

 

Is there a command within iRules to return a node from the msrdp cookie? I saw in the config guide that there is one for BEA WebLogic and I didn't know if there was one for MS Terminal Services since the BigIP has the ability to do this already. Thanks.
  • rapmaster_c_127's avatar
    rapmaster_c_127
    Historic F5 Account
    Yes, it only fires after the 3-way handshake. (CLIENT_ACCEPTED.) That's why we built the event driven hooks for iRules rather than firing them all the time.

     

     

    I'm glad you like the product. We love working on it.
  • rapmaster_c_127's avatar
    rapmaster_c_127
    Historic F5 Account
    Just one note: your rule code is only *entered* on the CLIENT_ACCEPTED event. Thereafter, CLIENT_DATA is fired upto the point you call TCP::release. At that point you have no more rule entry points and since you haven't hooked any more events, there will be no further rule processing impact.
  • Since removes the connection from load balancing statistics, would it be better for me to define all my servers in an external data group, then use

     

     

    use pool $my_pool [$node]

     

     

    Will this change anything? The goal is to make sure the BigIP is tracking the connections. Thanks.
  • unRuleY_95363's avatar
    unRuleY_95363
    Historic F5 Account
    I'm not sure I follow what you mean by "define all my servers in an external data group".

     

     

    I'm guessing what you might be wanting to do is define a data group/class that lists which pools each server is in and then use that to determine the pool so you can then use pool member . If that is what you are saying, then sure that would likely work just fine.

     

     

    However, let's revisit your assumption about statistics. Yes, it is true that if you use node , then statistics are not accounted for on the pool member. However, statistics are still accounted on the virtual and on the node itself. When using the pool member the statistics are also accounted on the node. So, perhaps you just need to look at the node statistics to get what you are looking for instead of looking at the pool member statistics. I have no idea how many other pools in your configuration the node might be a member of.

     

     

    Hope that helps.
  • Your assumption is correct. I am only concerned about the statistics as BigIP considers the load on a server. If I have 60 actual connections on a server, 30 of them being sent to the server via the rule line (use node $node), and I am using least connections, will those 30 connections sent to the server via the rule be considered in the decision or not? Thanks.

     

     

    Jason
  • drteeth_127330's avatar
    drteeth_127330
    Historic F5 Account
    Good question. If you use the member least connection LB method, then the 30 connections from the rule will not be accounted for since your rule uses direct node selection. If you use the least connection LB method, which operates on a node-address basis, then they will be.
  • This rule looks like exactly what I need, but I am having trouble getting it to work as written. I think this is because when you set the value of this cookie in the properties of the msrdp control, it sets it in Unicode. So if the value was Cookie: msts=2248151212.15629.0000 The rule doesn't ever get the node and port. Did you encounter the same problem? I think they may have changed the behavior of this property in a recent update, so this may not have been a problem when this rule was written.
  • It worked verbatim when I tested, but that was 18 months ago. We never implemented this code in production, so I'm not sure if there have been changes to the application behavior or not.