Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am using SQL server 2008 inside my home lan. I've configured it to accept remote connections and I can now connect to the server from other pcs inside the lan.

The problems rises when I try connecting to the server from a computer outside of my home lan. I've disabled my router's firewall and I've configured a virtual server on port 1433 forwarding to the correct lan ip. What's wrong? why is it not working?

Thank you very much for your help~!

Edit:

This is the error I keep getting:

A network related or instance specific error occured while establishing connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that the SQL SERVER is configued to allow remote connections. (provider : Sql network interfaces, error: 25- Connection string is not valid)

OK these are my router's details: edimax br-6204wg I am not sure how I am supposed to browse google.com. can you be a bit more specific?

share|improve this question
    
Since it's not an answer but an alternative, set up a VPN. If your router doesn't support it, look at products like OpenVPN or an inexpensive upgrade to a router that does (Netgear has products under $100 that do VPN/firewall/etc). It is far easier and safer than exposing your SQL server to the internet. –  Kevin Kuphal Jul 7 '09 at 20:12
add comment

6 Answers 6

When you're outside of your home LAN, first make sure you can ping the address you're trying to connect to. For example, if your home internet connection's IP address is X.X.X.X, then open a command prompt and type:

PING X.X.X.X

The X's will be replaced by numbers like 50.60.70.80. If the numbers start with 192, then it's not the real external IP address of your home internet connection.

If you can ping the IP address successfully and get an answer back, then next try telnetting to the SQL Server. Open a command prompt and type:

TELNET X.X.X.X 1433

If it doesn't time out, then you should be able to connect with SSMS, but I'm betting it'll time out. Some internet providers filter 1433 because it was the source of a few viruses.

Here's another good connection troubleshooting link - it's for SQL 2000, but the same basic issues apply:

http://support.microsoft.com/kb/827422

share|improve this answer
    
This FAQ comes most troubleshooting for SQL Server. tek-tips.com/faqs.cfm?fid=5481 –  mrdenny Aug 22 '09 at 5:43
add comment

Just a thought, where you are currently located may be blocking outbound ports. For example from your office the FW at the office is blocking ports on outgoing traffic.

share|improve this answer
    
It's be and a friend trying to develop something together. He installed an sql server instance, I am trying to connect from my home and I get this error. I turned off all firewalls, stil same error. –  vondip Jul 7 '09 at 20:06
1  
Is it using a named instance? Named instances run get dynamic port assignments. –  EasyEcho Jul 7 '09 at 20:07
add comment

Two possible problems:

  1. your SQL server doesn't know how to route to the gateway device (not likely if you can browse the web from it).
  2. Your virtual server on the firewall is a proxying device for web traffic, and doesn't understand your SQL traffic. You want "port-forwarding"

Exposing a SQL server to the Internet at large? Eh, I wouldn't do it if I'm storing Credit Card or Personally identifiable information.

share|improve this answer
    
1. What do you mean by browsing the web with my sql server? How can I check that? 2. how do I set sql traffic then? As to exposing sql out to the web... it's for development purposes only. I am exposing useless fields currently containning mostly 'test1' to 'test15' =] –  vondip Jul 7 '09 at 20:14
    
Log onto SQL server, browse google.com if you get a response, then routing isn't your issue. as to #2: I'm not 100% sure, you would have to post details about your router, any custom firmware you've loaded on it (openwrt for Linksys, etc.) and the exact configuration steps you made. –  darthcoder Jul 7 '09 at 20:31
add comment

There are a ton of things that can cause this. To narrow it down we would need a bit more information about your environment.

  • What are you trying to get to connect to SQL? A web app? SQL Server Management Studio?
  • Is this SQL Server 2008 Express or a full edition?
  • Are you trying to connect to the default instance or a named instance?
  • Do you have TCP/IP enabled on the server? (I'm assuming this is Yes)
  • Can you post your connection string? This is often the source of connection problems.

Here's a thread that you can read through that gives various solutions to this problem.

You might also need to allow connections to SQL through on the server if you have the firewall enabled:

  • Start > Run > Firewall.cpl
  • Click on exceptions tab
  • Add the sqlservr.exe (typically located in C:\Program Files\Microsoft SQL Server\MSSQL.x\MSSQL\Binn), and port (default is 1433)
share|improve this answer
add comment

Ensure that SQL Server is listening on the correct interface.

It may be that it is listening on an IP that is not accessable to your route. You can find these settings by opening SQL Server Configuration Manager and looking under Protocols for then TCP/IP and then look at the IP Addresses tab.

E.g. It could be listening on an IP6 address but your router only allows IP4 connections.

Failing that I recommend grabbing NMAP and having a look at what ports are available from certain locations. Run it from inside your LAN against the server to ensure the port is what you'd expect and then run it from your remote location against the router to see if that port is available.

The error message says your connection string is incorrect, please post so we can double check that

share|improve this answer
add comment

Thank you for your responses.

I'll be checking abigblackman answer more thoroughly later, currently I've installed Hamachi to breach between the my lan network and my friends so I can connect easily to the sql server. It works fine (very fast actually).

Once again, thank you for your support. Vondip

share|improve this answer
add comment

Your Answer

 
discard

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