IP BindingIP绑定

On this page本页内容

Overview概述

MongoDB binaries, mongod and mongos, bind to localhost by default. 默认情况下,MongoDB二进制文件mongodmongos绑定到本地主机。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命令行选项,则二进制文件会额外绑定到本地主机ipv6地址。

Considerations考虑因素

Warning警告

Make sure that your mongod and mongos instances are only accessible on trusted networks. 确保您的mongodmongos实例只能在受信任的网络上访问。If your system has more than one network interface, bind MongoDB programs to the private or internal network interface.如果系统有多个网络接口,请将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命令行选项,则二进制文件会额外绑定到本地主机ipv6地址。

To bind to all IPv4 addresses, you can specify the bind ip address of 0.0.0.0. 要绑定到所有IPv4地址,可以将绑定ip地址指定为0.0.0.0To 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

←  Network and Configuration HardeningConfigure Linux iptables Firewall for MongoDB →