0

I'm trying to connect to a SQL Server 2008 instance over the Internet through an ADSL Modem/Router. I've already configured the router to forward ports TCP 1433 and UDP 1434 to the IP of the server. I've also disabled the Windows Firewall on the server. I can connect locally to the instance using SQL Server authentication, but I'm unable to connect over the Internet, because it fails with the error message:

Error: Microsoft SQL Server Native Client 10.0 : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online.. Sqlcmd: Error: Microsoft SQL Server Native Client 10.0 : Login timeout expired.

I'm really out of ideas of what's wrong. Any help would be appreciated.

2
  • Have you tried running a packet sniffer to see what's going on over the wire?
    – jftuga
    Nov 19, 2010 at 17:33
  • @jftuga - I haven't tried but now I know that the problem was with my ISP blocking port 1433.
    – Norba
    May 25, 2011 at 20:35

4 Answers 4

3

I'll probably not be the only one to say this, but exposing a server to the general internet in this way is a bad idea. Consider some sort of VPN software, not only will it be far more secure, but you'll have a much easier time with the port forward setup. (You'll only need to route a single port through the modem to the server for the VPN connection and everything else will work through that).

Checkout http://www.openvpn.net for a decent, free VPN solution.

1
  • Thanks for the advice. I'll will try implement something like that in the coming weeks.
    – Norba
    Nov 19, 2010 at 19:34
1

It's probably because SQL Server is not listening over TCP/IP.

A default install of SQL Server will accept any incoming connections. This includes other machines on the same LAN, as well as from the Internet (which, in really means traffic coming from the router on your LAN).

You use the SQL Server Configuration Manager to enable other protocols that SQL Server will listen on (e.g. TCP/IP):

alt text

After that you'll have to re-enable the (old) default port 1433 for use: alt text

i would use Microsoft SysInternals TCPView to check that SQL Server is finally listening on the port you expect: alt text

This is all part of Microsoft's new broken by default strategy.

1
  • I'm pretty sure that's just SQL Express. I've installed dozens of SQL Server instances, and haven't had a problem with TCP/IP being enabled by default since SQL 2000.
    – KJ-SRS
    Mar 22, 2011 at 22:53
0

I'd recommend you open the following ports;

TCP 1433 (SQL Server), TCP 1434 (SQL Admin), TCP 4022 (SQL Service Broker), TCP 135 (SQL Debugger/RPC), TCP 2383 (Analysis Services), TCP 2382 and UDP 1434 (SQL Browser) plus maybe TCP 80 and TCP 443 if you're doing anything 'web-ey'.

3
  • Besides ports TCP 1433 and UPD 1434, I've also configured my modem/router to forward ports TCP 2382 and TCP 1434. Still can't connect to it. I don't think opening the other suggested ports would help. I'm not using the Service Broker neither Analysis Services.
    – Norba
    Nov 19, 2010 at 17:50
  • Can you telnet to those ports externally?
    – Chopper3
    Nov 19, 2010 at 18:06
  • I think the problem is not related with SQL Server. I've setup a PostgreSQL instance to run on port 1433 and I can't connect to it also.
    – Norba
    Nov 19, 2010 at 19:31
0

Use network scanner like nMap for checking that ports 1433 TCP and 1434 UDP (this one is only needed is you use named instances) are indeed opened to Internet. If the port is marked as closed or filtered that is probably due to:

  • Having an antivirus/security suite with some sort of firewall running.
  • The port forwading/redirection of the router is not properly configured or disabled.

PS: what SmallClanger says about using a VPN is a very good advice.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .