Forum Discussion

vincenthamilton's avatar
vincenthamilton
Icon for Nimbostratus rankNimbostratus
Oct 13, 2014

iRules to conserve IP's

I want to know how to create an irule to look at host headers and redirect the traffic to different web servers in LT M pools.

 

We have a GTM that does the DNS and an LTM with the nodes. I wanted to one public IP that send traffic to multiple wide IP's

 

say 217.144.222.12 is the public IP and redirected to demo.someadress.com demo1.someaddress.com

 

Does the irule go on the GTM or the LTM, and what format would it take?

 

thanks

 

3 Replies

  • Is SSL/TLS/HTTPS involved? If so, you have a few options depending on the certificate types. If not, things are easier. Either way, perhaps I'm over simplifying but surely multiple CNAMES would do the trick?

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    You'll probably want to run it on the LTM. If you need SSL you can configure SNI - that'll allow you to use a single IP-address for multiple hostnames. With the demise of Windows XP there aren't many clients that are not compatible with SNI.

     

    If you have a lot of hostname you should consider using a data class (group) with key/value pairs for the hostnames and the pool names (or even nodes).

     

    Also, since it sounds like you're consolidating, have you considered hosting multiple hostnames under a single web server instance? For some of the smaller sites I have provisioned I use an iRule that re-writes the URI to a specific folder on a web instance. The folder names match the hostnames, which allows our editors to simply create a new site by creating a folder that equals the hostname. After configuring the DNS the site is live. Since we're using a file server and multiple web servers there's also redundancy.

     

  • Arie's avatar
    Arie
    Icon for Altostratus rankAltostratus

    Here's a simple iRule to get you started:

    when HTTP_REQUEST {
    
        switch [string tolower [HTTP::host]] {
    
            "www.domain1.com" {
    
                pool poolForDomain1
    
            }
    
            "www.domain2.com" {
    
                pool poolForDomain2
    
            }
    
        }
    
    }