iRule for port forwarding ssh to port 2222 on Pool
Hi,
hope anybody can help 🙂
I have two LBs (activ/activ) and two Server in the Pool called RealSERVER, which are load balanced with lc.
On the two Real Server i have two sshd, which are listening to Port 22 and Port 2222.
The sshd (on both machines), which is listening to Port 2222 has the same rsa/dsa key, because i don't want a conflict, if the client wants to connect to the VIP.
If the Client wants to connect to the VIP via SSH, it would be great, if the LBs redirect traffic from 22 to Port 2222.
I've tested two iRules but both didn't work:
when CLIENT_ACCEPTED {
if { [TCP::local_port] == 22 } {
pool RealServer 2222
}
}
and
when CLIENT_ACCEPTED {
switch [TCP::local_port 22] {
2222 { pool RealSERVER}
default { discard }
}
}
If i use this iRule:
when CLIENT_ACCEPTED {
if { [TCP::local_port] == 22 } {
node 192.xxx.xxx.xxx 2222 IP RS1
node 192.xxx.xxx.xxx 2222 IP RS2
}
}
the connection will be redirect from 22 to 2222 but the load balance didn't work. Every time I connect via ssh to the VIP, i'm on RS1. If i open a second terminal i'm also connected to RS1.