The OpenVpn server is configured. When connecting, the client receives the address from the network 10.7.0.0/24 You need to connect to the postgres database located on the remote server: 10.20.30.40 Settings on the client, after connecting to the VPN:

 tun1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.7.0.6 PtP:10.7.0.5 Mask:255.255.255.255 UP POINTOPOINT RUNNING NOARP MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:100 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) $ ip route default via 192.168.43.1 dev wlp1s0 proto static metric 600 10.7.0.1 via 10.7.0.5 dev tun1 10.7.0.5 dev tun1 proto kernel scope link src 10.7.0.6 10.20.30.0/24 via 10.7.0.5 dev tun1 169.254.0.0/16 dev wlp1s0 scope link metric 1000 192.168.43.0/24 dev wlp1s0 proto kernel scope link src 192.168.43.204 metric 600 

Ie all calls to 10.20.30.40 go into the tunnel. Further connection to the database itself: psql -p 1234 -h 10.20.30.40 -U ubuntu test_BD Does not work. If I go through VPN to 10.7.0.1 and from there I execute the same command, then everything opens - that is, there already everything goes farther correctly. Where could the problem be?

  • Either the server does not allow clients to continue to walk around the network, or something is missing in pg_hba.conf. Either one of two things. - Sergey
  • Sergey, if the server did not allow traffic to go around the network, then it would be logical to assume that I could not run psql from any IP address from 10.7.0.0/24 . Now from the host 10.7.0.1 - the command is executed, as I wrote. By pg_hba.conf - could you describe in more detail in the answer, where can there be a plug? - Dofri
  • one
    Either there is no NAT at the exit of the tunnel and at the same time there is no route on the typewriter with postgresql where to return the packets. Those. syn flies, ask - flies the wrong way. Well, as far as I understood the scheme. - Small
  • Do tail 10.7.0.1 have no other address? And how does he then act as a server / router openvpn? On the one hand 10.7.0.1, on the other 10.20.30.xyz. Right? - Sergey
  • one
    Pg_hba.conf tells which clients postgres lets, and which figvam it draws. If, in principle, from the network to connect to it, then this file should be familiar. After all, the default allows connections only from localhost. Find this file, open in notepad. Everything will become clear. - Sergey

0