# Virtual & iRule

**URL:** <https://community.f5.com/t/virtual-irule/42036>\
**Category:** Technical Forums\
**Tags:** new-to-f5, basic, getting-started\
**Created:** [December 12, 2012, 1:36pm UTC](https://community.f5.com/t/virtual-irule/42036 "2012-12-12T13:36:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![genseek\_32178](https://avatars.discourse-cdn.com/v4/letter/g/f0a364/32.png) [@genseek\_32178](https://community.f5.com/u/genseek_32178)\
**Post date:** [December 12, 2012, 1:36pm UTC](https://community.f5.com/t/virtual-irule/42036/1 "2012-12-12T13:36:38Z")

</div>

Hi Experts,

We ve following iRule defined and mapped to a wild card VS on which VLAN 20 is enabled.

rule RULE1 {

when CLIENT\_ACCEPTED {

if { [IP::addr [IP::local\_addr] equals 203.36.135.10] }{

snatpool pool10

pool pool\_0

} elseif { [IP::addr [IP::local\_addr] equals 139.26.25.12] }{

snatpool pool2

pool pool\_0

}

!

Now question is - the IPs in the rule refer to the destination IP when packet is sourced from hosts in VLAN 20 outbound or do they refer to destination IPs in the packet coming into LTM from outside?

thnx-gseek

---

<div class="post-metadata">

**Author:** ![What\_Lies\_Bene1](https://avatars.discourse-cdn.com/v4/letter/w/59ef9b/32.png) [@What\_Lies\_Bene1](https://community.f5.com/u/What_Lies_Bene1)\
**Post date:** [December 12, 2012, 1:39pm UTC](https://community.f5.com/t/virtual-irule/42036/2 "2012-12-12T13:39:28Z")

</div>

From here: [https://devcentral.f5.com/wiki/iRul…\_addr.ashx](https://devcentral.f5.com/wiki/iRules.IP__local_addr.ashx): "When called in a clientside context, this command returns the IP address of the virtual server the client is connected to. When called in a serverside context it returns the self-ip address or spoofed client IP address LTM is using for the serverside connection. "

---

<div class="post-metadata">

**Author:** ![genseek\_32178](https://avatars.discourse-cdn.com/v4/letter/g/f0a364/32.png) [@genseek\_32178](https://community.f5.com/u/genseek_32178)\
**Post date:** [December 12, 2012, 1:45pm UTC](https://community.f5.com/t/virtual-irule/42036/3 "2012-12-12T13:45:54Z")

</div>

thanks Steve for the reply, but how to know if the connection is for clientside or serverside?

---

<div class="post-metadata">

**Author:** ![What\_Lies\_Bene1](https://avatars.discourse-cdn.com/v4/letter/w/59ef9b/32.png) [@What\_Lies\_Bene1](https://community.f5.com/u/What_Lies_Bene1)\
**Post date:** [December 12, 2012, 1:49pm UTC](https://community.f5.com/t/virtual-irule/42036/4 "2012-12-12T13:49:50Z")

</div>

No worries, that’ll be dictated by the event, in this case **when CLIENT\_ACCEPTED** 😉
