0

I want to connect to my remote SQL Server over a different network, namely the internet.

Even though my connection with Local IP is successful, I get connection error with Public IP (ex: 88.240.xxx.xxx).

I followed the steps below.

  1. I enabled SQL Server and Windows authentication modes
  2. I created a user
  3. I have enabled SQL Server to allow remote connections
  4. TCP/IP is enabled in SQL Server Configuration
  5. I set the TCP/IP>>TCPAll field to 1433
  6. I restarted SQL Server
  7. I added a rule for TCP and UDP in Windows Firewall
  8. I did port forwarding from the modem settings

After these steps, when I type local ip in the server name field, the connection is successful, but my connection with the public ip is lost. If anyone knows a way around this can help?

Error

A network-related or instance-specific error occurred while establishing a connection to SQL Server.
The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections.
(provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server) (Microsoft SQL Server, Error: 53)

Allowing Remote Connection

SQL Server authentication mode

SQL Server Configuration settings

Port Forwarding

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Rba Egn
  • 1
  • 2
  • 1
    Based on the error message the client is trying to use the named pipes provider instead of TCP. What happens if you type `ipAddress,1433` into SSMS on the remote client? – AlwaysLearning Nov 24 '21 at 07:12
  • @AlwaysLearning Thanks for your answer. In SSMS, I wrote ip, port number in the server name field. But still the connection failed.For example: I wrote 192.168.1.51, 1433. – Rba Egn Nov 24 '21 at 08:38
  • Possibly there's some confusion here over what Port Forwarding does. This is normally something to open a port on your router's public IP to connect to a service inside your own local area network. If your remote SQL Server is accessible on 88.240.xxx.xxx then you should just be using 88.240.xxx.xxx,1433 in SSMS. – AlwaysLearning Nov 24 '21 at 09:12
  • I'm sorry, in my previous comment I wrote that I got an error by showing my connection to my local network as an example. When I use only the public ip 88.240.xxx.xxx,1433 in SSMS, my connection fails. I do not have any problems with my connection with local ip. – Rba Egn Nov 24 '21 at 09:32
  • Exposing a database server to the internet is generally a [bad idea](https://serverfault.com/questions/19945/the-wisdom-of-exposing-a-database-server-on-the-internet) - especially if you do not have the networking and security expertise to understand how to do it and how to mitigate the risks. – SMor Nov 24 '21 at 12:57

0 Answers0