# iRule understand

**URL:** <https://community.f5.com/t/irule-understand/54346>\
**Category:** Technical Forums\
**Tags:** irules, security\
**Created:** [January 20, 2018, 5:11am UTC](https://community.f5.com/t/irule-understand/54346 "2018-01-20T05:11:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![sonu\_kumar4](https://avatars.discourse-cdn.com/v4/letter/s/9de0a6/32.png) [@sonu\_kumar4](https://community.f5.com/u/sonu_kumar4)\
**Post date:** [January 20, 2018, 5:11am UTC](https://community.f5.com/t/irule-understand/54346/1 "2018-01-20T05:11:41Z")

</div>

Hello Folks,

Could you please explain me the following iRule :-

when CLIENT\_ACCEPTED {

```tcl
if {[class match [IP::client_addr] equals private_net] } {
            pool MY_Internal_Farm
            log local0. "[IP::client_addr] is 1"
        } else {
            pool MY_proxy_farm 
            log local0. "[IP::client_addr] is 2"
        }
    }

```

---

<div class="post-metadata">

**Author:** ![Niels\_van\_Sluis](https://d1p9zq3aats0t8.cloudfront.net/user_avatar/community.f5.com/niels_van_sluis/32/3759_2.png) [@Niels\_van\_Sluis](https://community.f5.com/u/Niels_van_Sluis)\
**Post date:** [January 20, 2018, 7:32am UTC](https://community.f5.com/t/irule-understand/54346/2 "2018-01-20T07:32:51Z")

</div>

Based on the client source IP address it selects which pool will be used. Apparently all clients that come from private networks will be using the MY\_Internal\_Farm. The private networks are listed in the private\_net datagroup. All other clients will be using the MY\_proxy\_farm pool.

---

<div class="post-metadata">

**Author:** ![Surgeon](https://avatars.discourse-cdn.com/v4/letter/s/ce73a5/32.png) [@Surgeon](https://community.f5.com/u/Surgeon)\
**Post date:** [January 20, 2018, 7:34am UTC](https://community.f5.com/t/irule-understand/54346/3 "2018-01-20T07:34:23Z")

</div>

It is pretty easy. When TCP connection is established CLIENT\_ACCEPTED being triggered. If IP address of a client is in private\_net data group list then the request will be forwarded to a pool member of pool MY\_Internal\_Farm and the client’s IP address will be logged into /var/log/lmt

If the IP address of the client is not in private\_net data group then the request will be forwarded to a pool member of pool MY\_proxy\_farm and the client’s IP address will be logged into /var/log/ltm
