Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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?

share|improve this question
    
All you need to do is switch to a static port. That's it. –  Jon Seigel Nov 22 '13 at 3:47
add comment

1 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.

share|improve this answer
    
Thanks Mike and Jon. I can understand setting the static port number so that the external app can use the same connection string indefinitely, but would would internal app that's using the server name for the connection string need to specify the port # going forward? I'm under the impression that the Browser service will handle forwarding requests to the instance from the internal app even if it looks like it's attempting to connect via port 1433. –  MattyZDBA Nov 22 '13 at 15:56
1  
@MZDBA: The Browser service resolves the instance name to a port number based on what's set in the Properties dialog. It will work regardless of whether it's using static or dynamic ports. The application can (still) either use the instance name or the port number to connect. –  Jon Seigel Nov 22 '13 at 19:15
    
+1 on what Jon said. I touched on that really quick in my answer but should have expanded beyond just saying they should be fine :-) Good catch. –  Mike Walsh Nov 22 '13 at 19:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.