hello there,
I am trying to add a rule to go to a specific node in a pool when specific ip address is connected.
when HTTP_REQUEST {
if {[IP::addr [IP::remote_addr] equals 216.254.x.x]} {
pool poolname member 10.1.0.101
}
}
for some reason it doesn’t work :-/
I believe you are missing a port
pool poolname member
CB
tried doing
when CLIENT_ACCEPTED {
if { [IP::remote_addr] equals “216.254.x.x” } {
pool poolname member 10.1.0.101
}
}
nothing … same thing
even tho i tried log local0.info and it shows “216.254.x.x” inside the log
What kind of error are you receiving?
CB
actually there is no error
the irule is executed just fine
Did you perfom a tcpdump to see if the packet was leaving the F5 towards the server?
CB
the thing is, everything is working just fine because I have other rules inside " when HTTP_REQUEST "
and they r working just fine
it seems like the problem lies in if { [IP::remote_addr] equals “216.254.x.x” } {
but once again i logged [IP::remote_addr] inside the local0.info and it shows “216.254.x.x” so for some weird reason that if fails maybe i need to make sure [IP::remote_addr] is actually a “string” ?
Can you post the entire irule?
CB
when CLIENT_ACCEPTED {
if { [IP::client_addr] equals “219.254.86.x” } {
pool apache_webtier member 10.0.1.101:8080
}
}
when HTTP_REQUEST {
if { [HTTP::uri] contains “awstats/awstats.pl” } {
pool apache_webtier member 10.0.1.100:8080
}
if { [HTTP::uri] contains “web01” } {
pool apache_webtier member 10.0.1.101:8080
}
if { [HTTP::uri] contains “web03” } {
pool apache_webtier member 10.0.1.102:8080
}
if { [HTTP::uri] contains “web02” } {
pool apache_webtier member 10.0.1.100:8080
}
}
Looking at your logic the condition is if the client IP matches then go to a specific pool member, but then if the clients URI matches go to the other pool members. Is it possible that you meeting 2 conditions that is forcing it to another pool?
CB
i was thinking the same thing but first of all, the HTTP_REQUEST won’t match in my case and second i added a log in side the
if { [IP::client_addr] equals “219.254.86.x” } {
set client “[IP::client_addr]”
log local0.info " huh $client"
pool apache_webtier member 10.0.1.101:8080
}
and nothing shows in the log
the funny thing is if i make that special REQUEST and match one of those conditions and have that log statement inside it - it will log the ip just fine and it would be the one i need :-/
this is driving me crazy
I would remove the quotes between the address
something like
[IP::addr [IP::client_addr] equals 219.254.86.x]
CB
Looking at your code again I see that there is nothing wrong with the synax that would not allow pools to be accessed.
Okay time for a really stupid question. The x in the post is really you removing for public viewing - meaning there is actually a forth octet, yes?
CB
Okay time for a really stupid question. The x in the post is really you removing for public viewing - meaning there is actually a forth octet, yes?
YEP
I don’t see how your irule sytax is failing you. Have you simplified your Irule so that it’s forced to make one evaluation
when CLIENT_ACCEPTED {
if { [IP::client_addr] equals "219.254.86.x" } {
log local0. "If you see this in the LTM logs then it has meet the conditional statement"
pool apache_webtier member 10.0.1.101:8080
}
}
CB
just tried that, without any HTTP_REQUEST - nothing …
How about:
when CLIENT_ACCEPTED {
Log local0. "This is the Client IP: [IP::client_addr]"
if { [IP::client_addr] equals "219.254.86.x" } {
log local0. "If you see this in the LTM logs then it has meet the conditional statement"
pool apache_webtier member 10.0.1.101:8080
} else {
log local0. "if you see this in the LTM logs then it means you have not matched the conditional statement"
}
CB
Thats nice, butttttaaaaa i’m working on a “live” env. and that would log every single user :-/
interesting !
the output
Client IP: [IP::client_addr]
Change out the braces with quotes
when HTTP_REQUEST {
if { [HTTP::uri] eq "/myinfo" } {
HTTP::respond 200 Content "
client info
Client IP: [IP::client_addr]
"
}
}
CB