I was trying to figure out a small problem with connecting to vnc through an SSH tunnel today where one of the possible issues was that someone else was already tunneled to the port. Without going into the specifics of that problem, it made me realize I'm not as knowledgeable at how to ssh tunnels are allocating resources and how to view them.
So I have two questions. First, if I create an SSH tunnel but am not currently using that tunnel (ie, nothing on my local system has connected to the tunneled port) which ports are currently blocked and unavailable for others to use? I'm pretty sure my source port will be owned by my tunnel and thus not be available to be bound by another application, but what about the destination port? Is that port already bound to the tunnel or does it only get bound when I try to connect to my local port and the connection is tunneled through SSH to my destination port?
Secondly, how can I view what ssh tunnels exist on my system? If I created the tunnel locally I can do a ps and grep for the appropriate program, but if I have a client creating a local tunnel to my server's port is there a way that, from my server, I can see that this tunnel exists; even if the client has not yet connected to a program through the tunnel?