Forum Discussion
Damien_Turner_1
Nimbostratus
Oct 30, 2008Mutiple Email Server with static Addresses
Hi all I'm new to iRules and have become stuck!
I have 3 email servers and each have there own incoming VIP, but I need to make sure that when one of these email server sends a mail it get's sent out of that mail servers incoming address (need this so mail servers like yahoo.com and AOL.com will see the correct PTR.
NAT's and SNAT's don't work due to the default gateway pool filters the request first and sends the mail out of the floating address, so my iRule looks like this....
Expertly written by Mark and Damien October 2008
This iRule forwards mail to a pool depending on what the
source address is, if there is no matching source address the connection
will be passed to the default pool (mail_62.254.236.254).
when CLIENT_ACCEPTED {
if { [IP::client_addr] equals "192.168.0.41" } {
pool mail_213.106.234.254
log local0. "Valid client IP: [IP::client_addr] - StrongMailVIP1"
} elseif {
[IP::client_addr] equals "192.168.0.42" } {
pool mail_213.106.234.254
log local0. "Valid client IP: [IP::client_addr] - StrongMailVIP2"
} elseif {
[IP::client_addr] equals "192.168.0.43" } {
pool mail_213.106.234.254
log local0. "Valid client IP: [IP::client_addr] - StrongMailBox1"
} elseif {
[IP::client_addr] equals "192.168.0.44" } {
pool mail_213.106.234.254
log local0. "Valid client IP: [IP::client_addr] - StrongMailBox2"
} elseif {
[IP::client_addr] equals "192.168.0.5" } {
pool mail_62.254.236.254
log local0. "Valid client IP: [IP::client_addr] - Cobalt1"
} else {
log local0. "Valid client IP: [IP::client_addr] - OtherMail"
pool mail_62.254.236.254
}
}
This iRule does work but when it is running any host not listed cannot send any mail, I need it to be sent out of my pool mail_62.254.236.254
which doesn't seem to be working.
Please could someone guide me to the correct path?
Regards
Damien
- Damien_Turner_1
Nimbostratus
F5 Support can't seem to help me at all, they have said to look at Dev Central! - hoolio
Cirrostratus
Hi Damien,class mail_10.0.0.1_clients { network 192.168.1.0/24 host 192.168.20.1 }
class mail_10.20.0.1_clients { network 192.168.2.0/24 host 192.168.40.1 }
when CLIENT_ACCEPTED { Check if client is part of the first datagroup if {[matchclass [IP::client_addr] equals $::mail_10.0.0.1_clients]}{ Client matched first datagroup so use the corresponding pool pool mail_10.0.0.1_pool } elseif {[matchclass [IP::client_addr] equals $::mail_10.20.0.1_clients]}{ Client matched second datagroup so use the corresponding pool pool mail_10.20.0.1_pool } else { Take some default action? pool default_pool } }
- Damien_Turner_1
Nimbostratus
Hi Thankyou for responding, I have sorted the issue now. It was due to the SNAT pool getting confused as a NAT was in place for one but not the other, by changing the else to a SNAT_POOL rather than a pool it fixed the problem. - Damien_Turner_1
Nimbostratus
so it now looks like this.... (Have removed some of the hosts) - hoolio
Cirrostratus
Glad you got it working. It would be more efficient to use IP::addr to compare the client IP address against the critera for selecting a pool versus a string comparison:
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