NetScaler Load Balance multiple ports on same vServer

Have you ever created different Load Balancing Virtual Servers for the same service because multiple ports are required? Fancy sending multiple or ranges of ports through the same vServer instead? This is also possible and easy to implement.

As a result, I’ve produced this quick post just to show how it is possible.

When you are creating a Load Balancing Virtual Server, choose ANY under Protocol or you can choose TCP/HTTP etc. if for example you are working with multiple ports using the same protocol. Under Port type *. Continue on with the creation of the LB vServer.

1-minWhen you have the Load Balancing Virtual Server configured how you like, click on the edit icon next to Basic Settings. 2-minThe requirement is to create a listen policy so the Load Balancing Virtual Server only listens on specific ports that you specify. Use a command such as CLIENT.TCP.DSTPORT.EQ(8080) || CLIENT.TCP.DSTPORT.EQ(80). You can add as many ports as you like. Click Continue. 3-minNow the Virtual Server will only listen and answer on ports 8080 and 80. 4-min

If you have a range of ports you can use a command such as CLIENT.TCP.DSTPORT.BETWEEN(8080, 8090).


10 Comments

  • J. Hoffmann

    January 13, 2017

    Hi George,

    found a link to your site with Carl’s weekly news. First of all: great work, we all need guys like you and Carl, otherwise we mostly won’t be able to implement all those Citrix products and components! Thumbs up, indeed!

    I’m with NetScaler since 2008 and in the meantime part of the PTEC community, but never knew about that feature desrcibed above. It’ll really help me (and so others) in the future.

    Again, I really appreciate your work – many thanks for sharing, btw.

    Regards,
    Jochen (https://www.linkedin.com/in/jochenhoffmann).

    Reply
  • George Spiers

    January 13, 2017

    Hi Jochen

    Thanks for your comment and glad I can be of help! You are right, community produced information is critical and it’s great that we can all help each other.

    Take care

    Reply
  • Joe Khalil

    April 5, 2017

    Hi George
    Will this method map the port to the server at the back-end using that port?

    example: I create a LBVS with ANY protocol and * for ports then specify 9834 and 9835 in the policy. I then bind server A which uses service port as 9834 and server B with service that uses port 9835. Will traffic then be directed to specific servers? thanks

    Reply
  • George Spiers

    April 6, 2017

    Hi Joe if both servers listen on unique ports i.e. Server A listens on port 9834 but does not listen on port 9835, you’ll need to create a two vServers for each port. This method is for servers that use multiple ports together, so the vServer has a port of * and the services also have a port of *.

    Reply
    • Joe Khalil

      April 6, 2017

      thank you, yes indeed both servers listen on different ports. server A on 9834 only and server B on 9835 only. I tried the ANY protocol on the Load balancer side with * for ports and on the service for server A I put the port as 9834 and the service for server B port 9835 and tested connection and if I came in on 9835 I was still getting directed to Server A. So there is no port mapping using this method. I think my route will be a content switch server. thanks for your help!

      Reply
  • Alex Chen

    June 6, 2017

    very like!
    Thank you!

    Reply
  • Keith S

    August 22, 2017

    Is there anyway to do this with a Content Switching vserver?

    Also, is there any way to set multiple IP addresses for a vserver? I have a couple services where I use an internal IP AND a public IP for same service. Would there be a way for me to assign 2 IP’s to a single cs vserver without having to duplicate a bunch of configs?

    Reply
    • Keith

      August 22, 2017

      I’m a tool. I see that it is the same on CS vservers. I just never use the GUI so I didn’t realize at first I needed to expand the more settings option at first. I still am curious about the second part of my question.

      Reply
      • George Spiers

        August 22, 2017

        You can assign a public IP (Service) to one LB vServer, and an internal IP (Service) to another vServer and bind them to the same CS vServer, then use expressions to direct traffic to either one based on your requirements. You could also assign both internal and external services to the same LB vServer and attached that single LB vServer to the CSW, but keep in mind NetScaler will then Load Balance connections so you have to configure as to how you want Load Balancing to occur. I am going to assume that you have to send certain traffic to public and certain traffic to internal, so you would be best having two LB vSevers attached to the CSW.

        Reply
  • Aditya

    September 29, 2017

    Hi man,
    Thank for this explanation. I was currently working with similar Infra. This really help me understand this deployment.

    Reply

Leave a Reply