Forum Discussion

Allanwynn_16283's avatar
Allanwynn_16283
Icon for Nimbostratus rankNimbostratus
Nov 20, 2015

irule for snat pool and data group and pool member

Hi Everyone,

 

Can anyone help me to create an irule:

 

Pool Name: Pool_Test Member: a. 10.10.10.2 port 0 (ALL) b. 20.20.20.2 port 0 (ALL)

 

Datagroup name: dg_test

 

Snatpool: a. snat1 - 10.10.10.1 b. snat2 - 20.20.20.2

 

what i want is if the client ip is a member of the datagroup dg_test, he will use pool_test but will use the pool member 10.10.10.2 port 0 (ALL) and will be snat to snat1. then everything else will fall to pool_test pool member 20.20.20.2 port 0 (ALL) and snat2

 

Please help me.

 

6 Replies

  • Give this a whirl.

    when CLIENT_ACCEPTED {
        if { [class match [IP::client_addr] equals dg_test] }{
            pool pool_test member 10.10.10.2
            snat 10.10.10.1
        }
        else {
            pool pool_test member 20.20.20.2
            snat 20.20.20.1
        }
    }
    
    • Brad_Parker's avatar
      Brad_Parker
      Icon for Cirrus rankCirrus
      Only if you plan on changing the port. Since you have 0 configured for the VIP and your pools there's no need for port in the pool command.
  • Give this a whirl.

    when CLIENT_ACCEPTED {
        if { [class match [IP::client_addr] equals dg_test] }{
            pool pool_test member 10.10.10.2
            snat 10.10.10.1
        }
        else {
            pool pool_test member 20.20.20.2
            snat 20.20.20.1
        }
    }
    
    • Brad_Parker_139's avatar
      Brad_Parker_139
      Icon for Nacreous rankNacreous
      Only if you plan on changing the port. Since you have 0 configured for the VIP and your pools there's no need for port in the pool command.