wfaulk_98141
Mar 28, 2014Altostratus
Get information about Self-IPs in iRule
I have a need for an iRule that enables SNAT if the client and server addresses are in the same subnet. In practice, this only happens if the client and server addresses are on directly connected subnets.
I expect the iRule would look something like this:
when LB_SELECTED {
set client_net [ class match -name [IP::client_addr] equals "self-ip-nets" ]
set server_net [ class match -name [IP::server_addr] equals "self-ip-nets" ]
if { client_net eq server_net } {
snat automap
}
}
But that depends on the existence of a class called "self-ip-nets" that I would have to maintain separately from the actual device configuration, and that's an administrative overhead that's likely to break down.
I can't just assume that all subnets are of a particular size, because they're not.
Is there any way to get information about the locally connected networks on the LTM, specifically including netmask information, inside an iRule?