Linux prompts Error:listen (): Bind () failed errno:99 problem

Source: Internet
Author: User
Tags bind mongodb iptables

Server A builds the MongoDB, in order to be safe, set band_ip=127.0.0.1 in the configuration file/etc/mongod.conf. Recently, to allow other hosts to access the MongoDB of server A, the need to add the IP address of the host that needs to be accessed in the BAND_IP can be realized, and then modified to the following:

band_ip=172.0.0.1,10.20.12.33

Restart the Mongod service with the following error:

Error:listen (): Bind () failed errno:99 cannot assign address for requested

Many of the articles on the internet are said to be able to bind multiple IP, however, does not indicate that BAND_IP can only bind the MongoDB service in the machine's network card IP. To prevent intrusion, the following security strategy is made;

1,band_ip=0.0.0.0

2, add the iptables rule:

#禁止所有ip访问27017端口

Iptables-i input-p tcp–dport 27017-j DROP

#允许10.20.12.33 access to Port 27017

Iptables-i input-s 10.20.12.33-p tcp–dport 27017-j ACCEPT

#允许本机访问27017端口

Iptables-i input-s 127.0.0.1-p tcp–dport 27017-j ACCEPT

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.