Using ssh remote forwarding with two ip addresses at the same time?

I have been using sublime remotesubl package so that I can use sublime as the text editor to do work on a remote server. Following this remotesubl github tutorial, I was able to set up the system with remote port forwarding and etc. Now my question is, can I use the same port if I have two remote servers that I want to work on at the same time?

For example, my current ~/.ssh/config is set up like the following:

Host serverip1
    RemoteForward 52698 localhost:52698
    User foo

Host serverip2
    RemoteForward 52698 localhost:52698
    User goo

Say now if I open Sublime with one script on server1, and another one on server2, both servers are forwarding with the port 52698, will there be any conflict issues?

I am not familiar with port forwarding and I haven't been able to find the right information online. Hence I'd like to know if this is possible at all and if so, how should I set it up correctly? Any help is greatly appreciated!


In general: Two processes cannot try to listen on the same local port1 (as it would be impossible to distinguish them), but two processes can connect to the same remote port (as there's something else that keeps the connections distinct).

As this is a Remote forward – i.e. the "listening" ends are on two different servers, and both SSH clients are just connecting to your local localhost:52698 – it should not conflict. (Assuming Sublime can handle multiple inbound connections.)

(Local forwards would instead set up a listener on the SSH-client side and connect on the SSH-server, so trying to have two forward rules for the same port would conflict.)


1 (Technically, same address:port. It is possible to have two listeners by specifying also the listening address in the Forward option.)