本次IRULE主要是用來做智能選路用。
Remote_addr爲設備源IP, local_addr爲F5或者目標IP。
---------------begin-----------------------------
when CLIENT_ACCEPTED {
if {[matchclass [IP::remote_addr] equals ct_first_class]} {
pool ct_first_pool
}
elseif {[matchclass [IP::remote_addr] equals cnc_first_class]} {
pool cnc_first_pool
}
elseif {[matchclass [IP::remote_addr] equals loadbalance]} {
pool default_gw
}
elseif {[matchclass [IP::local_addr] equals cnc_class]} {
pool cnc_first_pool
}
else {
forward
}
}
----------------------end--------------------------------
執行後應該達到的目標是:
1、所有特殊IP如ct_first_class/cnc_first_class
2、 Loadbalance組則是做兩條線路負載
3、 所有去往中國電信cnc目標的都優先走電信,如果電信有問題則走聯通
4、 其它去往去除電信以外的如聯通、國內外其它運營商IP目標的話則走電信線路
5、 其它入向流量不匹配出向的轉發負載策略,直接forward看路由轉發!