0

Windows host with Vmware Workstation, and a linux guest. I have another Windows host with PostgreSQL running on localhost:5432.

I established NAT connection to be able to use Internet in VM. Vmnet1 hostonly and vmnet8 NAT.

The problem occurs when I import CSV data to my postgreSQL database using NIFI. It is unable to establish connection.

I also edited my server configuration so it listens to external requests. But still my attempts to connect to my server on main machine ended up like this:

psql -h 192.168.1.60 -p 5432 -U postgres -d POSTGRES

error: connection to server at "192.168.1.60", port 5432 failed: No route to host. Is the server running on that host and accepting TCP/IP connections?

When I connect to online free psql testing server it connects successfully.

Also there are two hosts on the same net as my VM addresses 192.168.1.X, and it fails to connect to them.

Is there anything wrong? Please free to ask questions.

8
  • 2
    localhost:5432 First of all, if you mean like it listens on 127.0.0.1 instead of e.g. 0.0.0.0, then it's not supposed to be accessible from any other hosts? Commented Jul 4, 2024 at 7:42
  • it is listening for 0.0.0.0 indeed, i edited the config of the posgresql Commented Jul 4, 2024 at 7:52
  • Consider adding the output of ip r of the VM. Also, are you sure it's not just the firewall on the servers? Commented Jul 4, 2024 at 7:59
  • default via 192.168.1.1 dev ens33 proto static 192.168.1.0/24 dev ens33 proto kernel scope link src 192.168.1.3 and yeah I checked firewall on both machines it is off Commented Jul 4, 2024 at 8:01
  • 1
    That looks like bridged networking instead of NAT or host-only? I assume the VM can reach the Internet? Is there any LAN host that is reachable from it? Is the bridge attached to a Ethernet NIC or WiFi adapter on the host? Commented Jul 4, 2024 at 8:07

1 Answer 1

0

it is essential that the host and the guest systems have different IP addresses and are reachable from each other. This could be virtual-lan or bridged networking. NAT networking will not work.

It is furthermore essential that the postgresql is listening on a reachable ip address (you may need to reconfigure it)

From there it should be possible to get dignotics from the server and client that will be sufficient to resolve any further problems if you heed them carefully.

3
  • if you mind asking me why? Because when I read about NAT it is stated it uses Host's ip as it's own to access the internet, so why It can not connect to localhost of the main machine Commented Jul 12, 2024 at 6:01
  • that's the problem, the guest is pretending to be the host, so when the host tries to send to the guest it ends up sending to itself instead. Commented Jul 12, 2024 at 21:40
  • Thanks Buddy I fixed as you said ans 'wuala' it is working now, have a nice day Commented Jul 15, 2024 at 4:27

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.