Forum Discussion

UBPClaw_95105's avatar
UBPClaw_95105
Icon for Nimbostratus rankNimbostratus
Feb 05, 2019

Pool redirect based on source IP and port

We have an application that listens on port 80, 443, and 808. We use http monitors which means instead of having a single 0 service pool each VIP has its own pool for the associated ports. We have a need to redirect requests from specific IPs to a isolated pool. But because there are three pools I have three irules and Im wondering how I can consolidate that to one that looks at source port and uses that to populate part of the pool name.

Here is what I have. Change the pool name for ports 443 and 808. Can I change to be something like pool -* and populate the * with the port the request came in on so I can have a single iRule?

when CLIENT_ACCEPTED {
switch [IP::addr [IP::client_addr] mask 255.255.255.0] {
    "1.1.1.0" -
    "2.2.2.0" {
        pool www.site.com-80
    }
  }
}

1 Reply

  • Try using the TCP::local_port data item, whose value should be either 80, 443, or 808 depending on which virtual server is being accessed.

    when CLIENT_ACCEPTED {
    switch [IP::addr [IP::client_addr] mask 255.255.255.0] {
        "1.1.1.0" -
        "2.2.2.0" {
            pool www.site.com-[TCP::local_port]
        }
      }
    }