我正在使用 Virtualbox 在 Mac OS X 上运行的虚拟机中使用 CentOS 7。
不幸的是,我无法从我的 Mac OS 主机连接到 VM 的数据库。我使用NAT作为虚拟机的网络并定义了一个规则来将主机端口 3017 转发到虚拟机的端口 27017,这是 mongod 的默认端口。可以看出使用VBoxManage showvminfo CentOS | grep 'NIC:
[hostOS]$ VBoxManage showvminfo CentOS | grep 'NIC'
NIC 1: MAC: 080027EF3CC0, Attachment: NAT, Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 1 Settings: MTU: 0, Socket (send: 64, receive: 64), TCP Window (send:64, receive: 64)
NIC …Run Code Online (Sandbox Code Playgroud)