Forum Discussion
Dave_73612
Nimbostratus
Jul 28, 2009Pool redirect based on source IP Range
Hi guys,
I need to write an IRule to route traffic to different pools based on source IP range.
Would this be the best syntax to use?
when CLIENT_ACCEPTED {
if { [IP::addr [IP::client_addr] equals 10.10.10.10] } {
pool my_pool
}
}
Can I just add a subnet mask to the "equals 10.10.10.10" in \ format?
Thanks in advance.
D
- hoolio
Cirrostratus
Hi,when CLIENT_ACCEPTED { if { [IP::addr [IP::client_addr]/24 equals 10.10.10.0] } { pool my_pool } }
- Dave_73612
Nimbostratus
Yep, - Dave_73612
Nimbostratus
Yep they are for that example however: - hoolio
Cirrostratus
It's the same whether you're explicitly providing an IP address or using IP::client_addr to get the client IP address. So the first two are equivalent, as are the second two if the client IP address for the test was 10.42.2.2 - paul_79097
Nimbostratus
is there a way to specify a range for ips? - hoolio
Cirrostratus
If 67.195.0.0 - 67.195.255.255 is close enough you could use [IP::addr [IP::client_addr]/16 equals 67.195.0.0]. - paul_79097
Nimbostratus
awesome - THANK YOU - Randy_Johnson_1
Nimbostratus
Where would a rule like this be applied ? - hoolio
Cirrostratus
Hi Randy,when CLIENT_ACCEPTED { log local0. "client IP:port [IP::client_addr][TCP::client_port]: [virtual name] [IP::local_addr][TCP::local_port]" if { [IP::addr [IP::client_addr] equals 209.221.139.195] } { log local0. "client IP:port [IP::client_addr][TCP::client_port]: Matched IP check, selecting Segregation_Pool" pool Segregation_Pool } } when LB_SELECTED { log local0. "client IP:port [IP::client_addr][TCP::client_port]: Selected server: [LB::server]" } when SERVER_CONNECTED { log local0. "client IP:port [IP::client_addr][TCP::client_port]: Connected server: [IP::server_addr]:[TCP::server_port]" }
- Randy_Johnson_1
Nimbostratus
Thanks !
Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects