【发布时间】:2017-05-16 19:57:15
【问题描述】:
目前我无法在我的虚拟 Ubuntu 机器上远程连接 mongodb 服务器。我无法连接到在我的 Windows PC 上运行的 Robomongo 客户端,该 PC 也在运行 vm。
这是两台电脑的 IP 地址
Windows:
Ethernet adapter Ethernet:
Connection-specific DNS Suffix . :
IPv4 Address. . . . . . . . . . . : 192.168.1.137
Subnet Mask . . . . . . . . . . . : 255.255.255.0
Default Gateway . . . . . . . . . : 192.168.1.1
Ubuntu:
enp0s3 Link encap:Ethernet HWaddr 08:00:27:6c:fc:9c
inet addr:192.168.1.134 Bcast:192.168.1.255 Mask:255.255.255.0
inet6 addr: fe80::9785:55d7:130:6618/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5021 errors:0 dropped:0 overruns:0 frame:0
TX packets:465 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:1231057 (1.2 MB) TX bytes:45237 (45.2 KB)
显示 mongo 正在运行的 Netstat:
netstat -tulpn | grep 27017
(Not all processes could be identified, non-owned process info
will not be shown, you would have to be root to see it all.)
tcp 0 0 127.0.0.1:27017 0.0.0.0:* LISTEN 3611/mongod
从这一点开始,我尝试在本地连接到服务器并且它可以工作:
mongo --port 27017
MongoDB shell version: 2.6.10
connecting to: 127.0.0.1:27017/test
然后我尝试将端口27017添加到ufw,仍然无法连接:
sudo ufw status
To Action From
-- ------ ----
27017 ALLOW Anywhere
27017 (v6) ALLOW Anywhere (v6)
提前感谢您的帮助。
【问题讨论】:
-
好吧,
127.0.0.1不能是主机外任何流量的源地址。您正在尝试从环回地址获取服务器,而不是可以在服务器主机之外使用的地址。
标签: mongodb ubuntu networking firewall robo3t