Forum Discussion

SW_159148's avatar
SW_159148
Icon for Nimbostratus rankNimbostratus
Aug 07, 2014

iRule for three virtual servers with three sets of ports

Setup

-Two Nodes

-Three sets of ports

1) HTTPS: 443

2) TCP: 7651, 7652, 7653, 7654, 7655, 7656

3) TCP: 9651, 9652, 9653, 9654

-One Virtual IP address shared for all three sets of ports

-All ports are load balanced on the two nodes

Requirement

-Create three separate VIPs

1) HTTPS (No problem here)

2) 7K range

3) 9K range

Issues

I run into problems when I start associating my monitors to pools and pools to virtual servers.

For the rest of this post, I will not talk about the HTTPS VS, since there are no issues there. I will focus on the 7k and 9k range.

Initially I thought I would create three different virtual servers as shown above.

-Create one monitor for the 7K range for port 7651

-Create one pool for the 7K range for port 7651

-Create one VS for the 7K range

-Create one monitor for the 9k range for port 9651

-Create one pool for the 9k range for port 9651

-Create one VS for the 9K range

Since I can’t add port changes in the GUI, I would need to do this with an iRule. Something like this:

when CLIENT_ACCEPTED {

if {([TCP::local_port] >= 7651) && ([TCP::local_port] <= 7656) } {

  pool 7k-POOL

} else reject

}

when CLIENT_ACCEPTED {

if {([TCP::local_port] >= 9651) && ([TCP::local_port] <= 9654) } {

  pool 9k-POOL

} else reject

}

This was all going great until I tried to create the 7K and 9K VS. Virtual servers can’t share the same source(0.0.0.0/0), destination(VIP), and port(*)

01070333:3: Virtual Server /Common/9K-VS illegally shares destination address, source address, and service port with Virtual Server /Common/7K-VS.

I am new to the F5 LTM and iRules. I was hoping someone can help me with a solution to have all three virtual servers for each of the three sets of ports, each with its own monitor, and to be able to detect a failed pool member and take the member out of the load. I am trying to keep complexity to a minimum.

Any help is greatly appreciated.

6 Replies

  • This link may be helpful - "http://support.f5.com/kb/en-us/solutions/public/14000/100/sol14163.html?sr=39455693".

     

    I think you may be able to get away with 2 virtuals - one for https, and one for port 0 (all ports). I have personal experience with a port 0 virtual, a Performance (layer 4), however, I have not applied any iRules to it. I think the TCP::local_port iRules would work to send to the respective pools.

     

  • Actually, come to think about it, you can make your VS port 0 AND your pool members port 0, so you technically could use 1 VS and 1 pool. However, concerning https, you would not be able to apply an http profile, preventing the use of http-type irules. So you probably want to keep the https as a standard VS with an http profile.

     

  • OK, why does the application team care that there is 3 virtual servers, if they all have the same IP address? I could understand if they wanted 3 virtual servers with 3 unique IPs. I have a similar application (financial world). I had to create 9 VS with the same IP address, each listening on a unique port (it's really not that cumbersome). The thing is, I did what I had to do to make the load-balancing work, but the software developers put no requirements on me regarding how I accomplished it.

     

  • The reason for three different virtual servers is that they have three different applications. So 443 will monitor IIS through an HTTPS monitor. The 7K and 9K ports are for two different applications, each with its own monitor.

     

    They would like to be able to shut down the 7K ports on one real server so that the 7K traffic will be sent to the other real server. At the same time, they would like the 9K port application to remain on the first server.

     

    We offered the option to create a unique VS for each port, but they wanted all 7k ports to failover if one of them goes down and the same for the 9K ports.

     

    In the end, it will probably be best to have multiple VIPs/Virtual servers.

     

  • Right. This is very similar to what we are doing. BTW, you can stack monitors up on the pool level (or pool-member level), so you are not limited to one. You can create a monitor for each application that correlates to each of the ports, say 7651, 7652, 7653, 7654, 7655, 7656. Just add the respective port in the Alias Service Port field of the monitor.

     

  • They would like to be able to shut down the 7K ports on one real server so that the 7K traffic will be sent to the other real server. At the same time, they would like the 9K port application to remain on the first server.

     

    i think this does not need to have separate virtual server, does it? since there are 2 pools, shutting down one application on one server would not affect other applications on that server.