Docs HomeMongoDB Manual

IP BindingIP绑定

On this page本页内容

Overview概述

MongoDB binaries, mongod and mongos, bind to localhost by default. If the net.ipv6 configuration file setting or the --ipv6 command line option is set for the binary, the binary additionally binds to the localhost IPv6 address.MongoDB二进制文件mongodmongos默认绑定到localhost。如果为二进制文件设置了net.ipv6配置文件设置或--ipv6命令行选项,则二进制文件将额外绑定到localhost IPv6地址。

Considerations注意事项

Warning

Make sure that your mongod and mongos instances are only accessible on trusted networks. If your system has more than one network interface, bind MongoDB programs to the private or internal network interface.确保您的mongodmongos实例只能在受信任的网络上访问。如果您的系统有多个网络接口,请将MongoDB程序绑定到专用或内部网络接口。

If the net.ipv6 configuration file setting or the --ipv6 command line option is set for the binary, the binary additionally binds to the localhost IPv6 address.如果为二进制文件设置了net.ipv6配置文件设置或--ipv6命令行选项,则二进制文件将额外绑定到localhost ipv6地址。

To bind to all IPv4 addresses, you can specify the bind ip address of 0.0.0.0. 要绑定到所有IPv4地址,可以指定0.0.0.0的绑定ip地址。To bind to all IPv4 and IPv6 addresses, you can specify the bind ip address of ::,0.0.0.0 or alternatively, use the new net.bindIpAll setting or the new command-line option --bind_ip_all.要绑定到所有IPv4和IPv6地址,可以指定绑定ip地址::,0.0.0.0,或者使用新的net.bindIpAll设置或新的命令行选项--bind_ip_all