Just found an iRule from one of my customers.
In 11.4.1 HF10, the virtual server is configured with an MBLB profile and an iRule, briefly as below:
ltm virtual /Common/vs_MBLB {
cmp-enabled no
destination 10.10.10.10:10000
enabled
ip-protocol tcp
mirror enabled
pool /Common/pool_MBLB
profiles {
/Common/customized_mblb {
context all
}
/Common/tcp {
context all
}
}
rules {
/Common/rule_MBLB
}
source-address-translation {
pool none
type automap
}
source-port change
}
Part of the iRule is as follows:
ltm rule /Common/rule_MBLB {
when CLIENT_ACCEPTED {
log local0. "conn established:[IP::client_addr]:[TCP::client_port]"
set close 0
}
when CLIENT_CLOSED {
log local0. "client close[IP::client_addr]:[TCP::client_port]"
set close 1
}
when SERVER_CONNECTED {
after 1000 -periodic if { $close } { TCP::close; }
log local0. "server connect serverip:[IP::server_addr]and[TCP::remote_port]and[TCP::local_port]"
TCP::collect
}
}
Just wonder whether what I supposed below is right or not?
As what I understand, if MBLB profile is configured, the client side connections and the server side connections haven’t a mapping to each other. Thus, for the CLIENT_CLOSED event and the SERVER_CONNECTED event, it should be that the variable named “close” cannot be passed to the server side and the TCP::close command in the SERVER_CONNECTED event can never happen.