Forum Discussion
irules to check if the client IP belongs to the Pool
Hi
I'm trying to write an irule to do selective SNAT but i get an error saying
invalid IP network mask specification (line 2) invoked from within "IP::addr [IP::client_addr] equals [active_members -list [LB::server pool]]"
Here you are my irule
when CLIENT_ACCEPTED { Check if the client IP address is a node in the VIP's default pool if { [IP::addr [IP::client_addr] equals [active_members -list [LB::server pool]]] }{
log local0. "SNAT'ing for [active_nodes -list [LB::server pool]] , member of pool [LB::server pool]"
snat automap
} else { snat none log "snat none [IP::client_addr] [IP::remote_addr] "} }
I don't know what is wrong...
Thank you for your help
1 Reply
- nathe
Cirrocumulus
Laurent,
"active_members -list" will return the IP address and port, so something like 192.1.1.1 80 for example. This then won't match the IP::addr / IP::client_addr commands I'm afraid.
My quick thoughts would be to create a datagroup instead, using the pool members. Something like 192.1.1.1/32 and do a lookup to this datagroup instead of the pool.
Perhaps not perfect but an option. Perhaps better iRulers here might have better options.
Hope this helps,
N
Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com