Forum Discussion

khansafdarali1_'s avatar
khansafdarali1_
Icon for Nimbostratus rankNimbostratus
Jan 30, 2017

Need to create and i-rule which directs traffic coming from these 3 IP address to btsxv-old-pool and the rest of the traffic goes to btsxv-new-pool.

Need to create and i-rule which directs traffic coming from these 3 IP address {209.177.18.1, 209.177.18.2, 209.177.18.3} to btsxv-old-pool and the rest of the traffic goes to btsxv-new-pool.

 

6 Replies

  • **Create data group: my_ip_db --or whatever name you want and add your IP's: 209.177.18.1 209.177.18.2 209.177.18.3

    iRule:

    when HTTP_REQUEST {
        if { [class match [IP::client_addr] equals my_ip_dg] } {
            pool btsxv-old-pool}
    else {pool btsxv-new-pool}
        }
    }
    
  • To expand on Shaun's answer, your data group should be of the type "Address", with the IP addresses entered as three records. If you do not specify a subnet mask for an address, it defaults to a /32.

    Here is an example that I created showing a single host as well as a /24 sized subnet.

    ltm data-group internal DG_SourceIP {
        partition Common
        records {
            1.1.1.1/32 { }
            2.2.2.0/24 { }
        }
        type ip
    }
    
  • We are using port 22. Do we use "when client_accepted" instead of "when HTTP_REQUEST"?

     

    • khansafdarali1_'s avatar
      khansafdarali1_
      Icon for Nimbostratus rankNimbostratus

      while creating the irule I am getting the following error.

       

      01070151:3: Rule [/Common/btsnp] error: /Common/btsnp:6: error: [command is not valid in the current scope][}]