0

I have a debian server that is hosting multiple services in docker containers. One of these services is a MS SQL Server, which I connect/ use on my local network and now am trying to access from a remote network.

I have enabled/configured openSSH on the host and have been able to connect to the system on my local environment. I've also been able to establish a connection on port 22 remotely after forwarding the ports on my router/firewall.

However when I try to access the SQL Server which is listening on another port the connection times out. I've forwarded the port in PuTTY as outlined in this article and in my SSMS I use 127.0.0.1,2021 (local listener). The remote port has also been forwarded on the router as demonstrated in this tutorial.

In desperation, I've also tried to use dynamic port forwarding (covered in this tutorial) which also failed. I don't think that is what I'm going for but wanted to try everything before posting.

Even though I appear to be able to establish a remote SSH connection, I cannot establish a connection with the database. Is there something that needs to be configured in openSSH or docker/portainer? Please advise. Thanks!

edit: Is this the same problem I am having? access host's ssh tunnel from docker container As I read through this post it seems like it is having a connection issue from the other direction.

Boximity
  • 9
  • 3
  • So when you `docker container ps -all` what port(s) does the SQL container publish? It's normal to publish `1433/tcp`, in which case your SSH tunnel could be established using something like `-L 2021:1433` – AlwaysLearning Oct 28 '21 at 23:48
  • yeah exactly I'm using the the default `1433/tcp` and have established the tunnel as you mentioned using PuTTY – Boximity Oct 29 '21 at 01:35
  • Perhaps Windows firewall is blocking connections to the tunnel port opened by PuTTY then. Have you gone to Windows Firewall with Advanced Security > Inbound Rules and added a rule that allows incoming connections to the PuTTY executable? – AlwaysLearning Oct 29 '21 at 05:46
  • One thing that's not clear from your question is whether you've successfully connected to the SQL instance from the Debian server or not. Consider using a tool like [mssql-cli](https://learn.microsoft.com/en-us/sql/tools/mssql-cli?view=sql-server-ver15#linux-installation). First prove that the SQL Server instance is connectable from there, before trying to double-hop/tunnel through. – gvee Oct 29 '21 at 07:25
  • @AlwaysLearning I just tried that and I am still timing out. Good thinking though – Boximity Oct 29 '21 at 14:43
  • hey @gvee yes I can connect to the SQL instance no problem on my local network...is there a command I should run from CLI that will tell me something about the configuration? – Boximity Oct 29 '21 at 14:44

0 Answers0