PostgreSQL connection refused. Client presents with public IP address - postgresql

I have .NET Core application which uses PostgreSQL. When I installed application on a machine which is presented to internet via IP address (Mikrotik via dst-nat), PostgreSQL server refuses connection with information that public IP address can't connect to PostgreSQL server.
But on Mikrotik router, I see that client tries to connect via internal IP address on the server port 5432, but (somehow) presents via public address. PostgreSQL server and client are in different subnets.
Thanks.

Related

How do I configure my Aurora SQL database to be accessible using pgAdmin and fix a timeout expired error?

Following this tutorial, I set up an Aurora PostgreSQL database. I then tried to access the database from my computer using pgAdmin. However, pgAdmin gives the error: "Unable to connect to server: timeout expired"
I have tried the following things:
Ensured that the database is set to be publicly accessible
Verified that the database has an IP address (I ran nslookup on my local machine, and it returned a public IP address).
Verified that the database is in a public subnet (it is launched in two subnets, one of which is a public subnet with an Elastic IP address and one of which is a private subnet which directs traffic to a NAT gateway)
Ensured that my database is configured to use port 5432
Modified the security group to add inbound rules allowing TCP traffic on port 5432 from any IPv4 or IPv6 address
Ensured that I can send outbound traffic on port 5432 from my computer using this site
It looks like you have deployed the Aurora DB cluster into two subnets of a VPC and the problem is that one subnet is public, while the other is private. I suspect the DB will be accessible publicly as long as the public DNS resolves to the DB instance in the public subnet, but will be unreachable when it resolves to the instance in the private subnet (though I have not verified this).
To correct this and make the cluster publicly accessible, deploy the DB into public subnets only.

Access server from anywhere without public IP and/or Port forwarding

Currently we have a home Internet connection with a public static IP, 100up10down for 60$/m, since we got a really good offer 500down100up for 12$/m we are going to switch internet provider. The catch, the new provider does not offer public IP and/or Port forwarding.
I have one home server and one server in a Datacenter.
Is there a solution for me to route traffic through my "public" server to my home server?
I have root access (obviously) to both server, is there something that I could install on my datacenter server that routes traffic to my private server?
I thought maybe there is something (software) where my private server connects to port 1234 on my datacenter server and if the datacenter server receives data on port 1234 it forwards it to my private server.
Google for port forwarding services.
https://portmap.io/
There are other ones that I can’t find right now.

MongoDB connection refused if my public IP matches the one of the server

I created a public MongoDB server which is hosted on one of my computers. To test it I connected to another network on my laptop and connected to the server using my public IP and the port that I forwarded for MongoDB.
This worked fine.
However, if I connect my laptop to my LAN, the same one in which the server is connected to, I get a error:
[Errno 111] Connection Refused
Is it possible for me to connect to my own public server if my public IP matches the public IP of the server? It seems like some infinite feedback loop is happening where my public network is trying to connect to my public network.
I could always test if the clients public IP matches the server IP, and if it does to connect directly using the host computers IP instead, but first I want to see if there's a better way to handle this.
You cannot have two machines on the same network segment with the same address. This will cause issues with all kinds of applications because both machines will try to respond to traffic directed to either one.

unable to connect to openfire server with external ip

I'm trying to connect to openfire server using spark. I have dynamic dns, made port forwarding on port 5222 in d-link router. When i'm logging with host name as private ip for example "192.168.0.101" - connection is established, but when i'm setting my domain (pizokas.hopto.org) as host name i get the following error
Unknown connection error. Please review logs for the following information.
But there are no logs in openfire server, so i assume packets are dropped in router. I have firewall turned off. At this point i can't find information why the connection cannot be established. I'm using my own laptop as server and as a client, os win 10. Maybe somebody had similar issue?
The connection was established when i was trying to connect to server from outside of lan

Connect Local Host from Web Service

I have a Laptop, with msSql sever 2005, and it is connected to my Wifi router which gets the internet. So My laptop get connected to internet. But I need to access my msSql Sever from internet to connect my webpage which I made using ASP.Net.
Please Help me... And please give a solution for this...
You'll need your IP adress to connect, then open the SQL-Port in your router. (default is 3306)
When you connect to the server just use your current ip adress.
Maybe you want a static ip or something like http://dyndns.org
you want to write web service and host that service in sql machine
First setup a static IP address on your laptop and after that you need to set up port forwarding in your router. This process differs slightly depending on your routers manufacturer and model.
After this is set up properly make sure that SQL Servers port is open on your laptops firewall.
By using Dynamic DNS you can point to your possibly changing IP address with static name so you don't have to change this constantly in your connection string.