Sql-server – How Should TCP/IP be configured to allow an external application access to SQL via the same port #

configurationdynamic-portsNetworksql servertcpip

My SQL Server instance is hosted on an internal network server (10.x.x.x address). It's a named instance currently using dynamic ports. An external application at a third-party hosting location connects to the instance through use of the IP address and port #. After each maintenance window I have to confirm the dynamic port # in use is the same as before as the firewall rule is set to allow connections between application host and database host on that specific port #.

Is this the correct way to ensure the externally-hosted app can connect to the host without having to change port numbers in the connection string or should another port forwarding method be used (i.e., port 9999 on application host is mapped to port 1434 on SQL host)? What configuration manager changes in the Network Configuration section should be applied to allow the external application to use the same port # but internal applications to rely on the Browser server to make the correct mapping?

Best Answer

Not sure if I fully understand the question. But the internal applications should be fine about the port number unless there are also firewalls internally, in which case you just allow the port through there.

For the external access, I'd consider a static port so you can stop doing what you have to do. In an ideal world you'd only really expose your SQL Server to the web server itself externally, so if the firewall can just trust the webservers IP only that is a good thing to do only, instead of just being wide open for that port for any incoming traffic.

But you just ned to set an static port in the network config:

enter image description here

So instead of a 0 for dynamic ports, type a port number in for the TCP Port you wish to use.