不能再连接到VirtualBox中的PostgreSQL

时间:2018-12-18 17:37:20

标签: postgresql jdbc operating-system virtualbox

MacBook Pro(13英寸,2017年,两个Thunderbolt 3端口),OS X 10.12.6,VirtualBox 5.2.22

我有一年前保存在CentOS 7.4.1708中的PostgreSQL 9.2.23的VirtualBox快照。那时,我可以使用Razor SQL和其他应用程序从主机Mac连接到它。从那时起,我对其进行了数次恢复,效果很好。

这周我又恢复了它,无法再使用Razor SQL进行连接。我可以ping实例的IP地址,将其SSH到其中,并使用psql。 VM的IP地址未更改,PostgreSQL仍在使用端口5432。

VM使用桥接适配器。物理适配器已更改,我切换到另一个扩展坞。将适配器切换到内置WiFi无效。

pg_hba.conf设置:

    # TYPE  DATABASE        USER            ADDRESS                 METHOD

local   all             all                                     trust
host    all             all             0.0.0.0/0               trust
host    all             all             ::1/128                 ident

postgresql.conf连接和身份验证设置:

listen_addresses = '*'              # what IP address(es) to listen on;
max_connections = 100           # (change requires restart)

相关的netstat输出:

tcp        0      0 0.0.0.0:5432            0.0.0.0:*               LISTEN     
tcp6       0      0 :::5432                 :::*                    LISTEN     
unix  2      [ ACC ]     STREAM     LISTENING     20039    /var/run/postgresql/.s.PGSQL.5432

虚拟机中的ifconfig:

enp0s3: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.7.53  netmask 255.255.255.0  broadcast 192.168.7.255
        inet6 fe80::126f:f1a8:7d36:a935  prefixlen 64  scopeid 0x20<link>
        ether 08:00:27:a0:df:da  txqueuelen 1000  (Ethernet)
        RX packets 660271  bytes 990475536 (944.5 MiB)
        RX errors 0  dropped 1  overruns 0  frame 0
        TX packets 265677  bytes 17771022 (16.9 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

防火墙:

[root@localhost robert]# iptables -L -n
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:53
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:53
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:67
ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            tcp dpt:67

Chain FORWARD (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     all  --  0.0.0.0/0            192.168.122.0/24     ctstate RELATED,ESTABLISHED
ACCEPT     all  --  192.168.122.0/24     0.0.0.0/0           
ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable
REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-port-unreachable

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         
ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp dpt:68

[root@localhost robert]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
  Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
  Active: inactive (dead)
   Docs: man:firewalld(1)

有什么建议吗?

0 个答案:

没有答案