紀錄一下我自己使用到的iRule
1.SNAT
1:1 NAT
192.168.1.1:2.2.2.100
192.168.1.2:2.2.2.101
192.168.1.3:2.2.2.102
when CLIENT_ACCEPTED {
if {[IP::addr [IP::client_addr] equals 192.168.1.1] } {
pool pool_gw_1
snat 2.2.2.100
} elseif {[IP::addr [IP::client_addr] equals 192.168.1.2] } {
pool pool_gw_1
snat 2.2.2.101
} elseif {[IP::addr [IP::client_addr] equals 192.168.1.3] } {
pool pool_gw_1
snat 2.2.2.102
} else {
snat automap
}
}
2.Redirect
80 redirect 443
when HTTP_REQUEST {
HTTP::redirect https://[getfield [HTTP::host] ":" 1][HTTP::uri] }
80 redirect 81
when HTTP_REQUEST {
HTTP::redirect http://[getfield [HTTP::host] ":" 1]:81[HTTP::uri] }