Forum Discussion
monica_74227
Nimbostratus
Jun 10, 2009outbound iRule help
hey guys, i make a irule to use choose diffrent links as following:
when CLIENT_ACCEPTED {
if { [matchclass [IP::local_addr] equals $::CNC_class]} {
pool ISP-WANGTONG-FIRST
}
elseif { [matchclass [IP::local_addr] equals $::CT_class]} {
pool ISP-DIANXIN-FIRST
}
else {
pool ISP-GW-POOL
}
}
when LB_SELECTED {
if {[IP::addr [LB::server addr] equals 221.218.250.62] and [IP::addr [IP::client_addr] equals 10.6.1.1] or [IP::addr [IP::client_addr] equals 10.6.1.2] } {
snat 221.218.250.61
}
elseif {[IP::addr [LB::server addr] equals 202.224.233.89] and [IP::addr [IP::client_addr] equals 10.6.1.1] or [IP::addr [IP::client_addr] equals 10.6.1.2]} {
snat 202.224.233.90
}
else {
snat automap
}
}
Thank you for correcting me !
5 Replies
- The_Bhattman
Nimbostratus
What exactly is your question? Are you have problems getting it to work? If so what describe the problem in detail.
Thanks,
CB - monica_74227
Nimbostratus
Posted By cmbhatt on 06/12/2009 3:02 PM
What exactly is your question? Are you have problems getting it to work? If so what describe the problem in detail.
Thanks,
CB
thank you for your reply!
well, the host 10.6.1.1 and 10.6.1.2 just be permited to use 221.218.250.61 as the source address to connect the remoter server, the other words, the two hosts just can go out with the one link. howerver we don't know the remoter server's IP address.
how could I to wirte the iRules, thank you very much! - monica_74227
Nimbostratus
hey guys, I fixed the iRule, but always generate errors, thank you for your help:
when CLIENT_ACCEPTED {
if { [mathclass [IP::client_addr] equals $::Uni_client_class]} {
pool Uni_first_pool
}
elseif { [matchclass [IP::local_addr] equals $::Uni_class]} {
pool Uni_first_pool
}
elseif { [matchclass [IP::local_addr] equals $::CT_class]} {
pool CT_first_pool
}
else {
pool Default_gateway_pool
}
}
when LB_SELECTED {
if {[IP::addr [LB::server addr] equals 221.218.250.62] and [IP::addr [IP::client_addr] equals 12.10.10.2] or [IP::addr [IP::client_addr] equals 12.10.10.1] } {
snat 221.218.250.61
}
elseif {[IP::addr [LB::server addr] equals 202.224.233.89] and [IP::addr [IP::client_addr] equals 12.10.10.1] or [IP::addr [IP::client_addr] equals 12.10.10.2]} {
snat 202.224.233.90
}
else {
snat automap
}
}
thank you very much! - hoolio
Cirrostratus
There is a typo: mathclass should be matchclass. Also, you should use parentheses to ensure the logic in LB_SELECTED is correct:
if { ([IP::addr [LB::server addr] equals 221.218.250.62] and [IP::addr [IP::client_addr] equals 12.10.10.2]) or ([IP::addr [IP::client_addr] equals 12.10.10.1]) } {
...
elseif { ([IP::addr [LB::server addr] equals 202.224.233.89] and [IP::addr [IP::client_addr] equals 12.10.10.1]) or ([IP::addr [IP::client_addr] equals 12.10.10.2])} {
Aaron - monica_74227
Nimbostratus
Posted By hoolio on 06/15/2009 8:39 AM
There is a typo: mathclass should be matchclass. Also, you should use parentheses to ensure the logic in LB_SELECTED is correct:
if { ([IP::addr [LB::server addr] equals 221.218.250.62] and [IP::addr [IP::client_addr] equals 12.10.10.2]) or ([IP::addr [IP::client_addr] equals 12.10.10.1]) } {
...
elseif { ([IP::addr [LB::server addr] equals 202.224.233.89] and [IP::addr [IP::client_addr] equals 12.10.10.1]) or ([IP::addr [IP::client_addr] equals 12.10.10.2])} {
Aaron
Thanks
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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