cf ssh forces users to use port 2222.
cf ssh doesn't allow you to change the default port. In some cases, there is a load balancer that is listening to a different port and that port cannot be changed for security reasons.
The workaround to this issue is to execute ssh directly against the load balancer IP and PORT as explained below:
cf ssh-codecf app APP_NAME --guidAPP_NAME with your own app name.PORT, APP_GUID and the LB-IP (load balancer IP):
ssh -p <PORT> cf:<APP_GUID>/0@<LB-IP>4. Input the passcode retrieved in step 1 when prompted.