Getting MongoDB on Linux to listen to remote connections












54














I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).



When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.



However, I could not access the server from remote. When I type testmongoserver:28017 it doesn't open the HTTP console as localhost:28017 on my local machine does. I also can't connect using official drivers and providing a connectionstring.



What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017



Thanks!










share|improve this question
























  • Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
    – DrColossos
    Aug 23 '11 at 12:12












  • make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
    – Deep Kapadia
    Aug 23 '11 at 15:18
















54














I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).



When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.



However, I could not access the server from remote. When I type testmongoserver:28017 it doesn't open the HTTP console as localhost:28017 on my local machine does. I also can't connect using official drivers and providing a connectionstring.



What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017



Thanks!










share|improve this question
























  • Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
    – DrColossos
    Aug 23 '11 at 12:12












  • make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
    – Deep Kapadia
    Aug 23 '11 at 15:18














54












54








54


19





I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).



When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.



However, I could not access the server from remote. When I type testmongoserver:28017 it doesn't open the HTTP console as localhost:28017 on my local machine does. I also can't connect using official drivers and providing a connectionstring.



What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017



Thanks!










share|improve this question















I've successfully installed MongoDB on Windows (on a local machine) as a service, but now I want to move MongoDb to a separate server. So I extracted the tarball to a virtual server on network (running linux).



When I connected to the server ("testmongoserver") using PuTTY from my local machine, I started the mongod server and it told me that it was listening to the default 28017 port. The mongo console is also working and allowed me to create a new database (testdb) and add users to it.



However, I could not access the server from remote. When I type testmongoserver:28017 it doesn't open the HTTP console as localhost:28017 on my local machine does. I also can't connect using official drivers and providing a connectionstring.



What are the neccesarry steps to install MongoDB on Linux, so that I could access it from a remote machine with a connectionstring and use its HTTP console via testmongoserver:28017



Thanks!







linux networking mongodb






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jul 6 at 14:45









Yves M.

18.1k116897




18.1k116897










asked Aug 23 '11 at 10:37









user315648

97011429




97011429












  • Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
    – DrColossos
    Aug 23 '11 at 12:12












  • make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
    – Deep Kapadia
    Aug 23 '11 at 15:18


















  • Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
    – DrColossos
    Aug 23 '11 at 12:12












  • make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
    – Deep Kapadia
    Aug 23 '11 at 15:18
















Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
– DrColossos
Aug 23 '11 at 12:12






Are you using the correct Connection Strings? mongodb.org/display/DOCS/Connections Changed any settings? mongodb.org/display/DOCS/File+Based+Configuration
– DrColossos
Aug 23 '11 at 12:12














make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
– Deep Kapadia
Aug 23 '11 at 15:18




make sure there is no firewall rule (on either side) that prevents you from connecting to the remote server.
– Deep Kapadia
Aug 23 '11 at 15:18












5 Answers
5






active

oldest

votes


















20















  1. Run netstat -a on mongo server and check a port.

  2. Check DNS settings and check that linux server allows external connections.

  3. Check that mongodb can accept external/remote connection.


Default port for mongo is 27017.
28017 - port for webstats.



See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports






share|improve this answer





















  • @user315648 Any changes?
    – Andrej Ludinovskov
    Aug 23 '11 at 14:57






  • 6




    My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
    – absynce
    Apr 18 '14 at 18:57










  • Sometimes, the server needs to be restarted for the change to take effect.
    – Arthur
    Dec 30 '15 at 21:56



















79














1. Bind IP option



Bind IP is a MongoDB option that restricts connections to specifics IPs.



Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:




  1. Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.

  2. Remove or comment (with # character) the bind_ip line. But be aware that all remote connection will be able to connect your MongoDB server!


More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp



Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip



2. Firewall



Check that you are not running behind a firewall






share|improve this answer



















  • 2




    Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
    – Abraham Philip
    Jan 17 '15 at 12:50










  • I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
    – Temak
    Jul 8 '16 at 12:52





















31














Make sure in your /etc/mongodb.conf file you have the following line,



bind_ip = 0.0.0.0


http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html






share|improve this answer



















  • 6




    This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
    – seanmakesgames
    Oct 13 '14 at 18:50








  • 4




    Really BAD idea, specially with new vulnerability when using mongo.
    – Rick
    Jan 27 '16 at 1:57






  • 3




    Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
    – victorkurauchi
    Jun 7 '16 at 16:26










  • the correct file name is "/etc/mongod.conf"
    – Omidam81
    Jul 28 '16 at 20:19










  • I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
    – newman
    Feb 28 '17 at 1:29



















7














Just had this issue and this fixed it:



Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):



# network interfaces
net:
port: 27017
bindIp: 0.0.0.0


Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):



sudo service mongod restart



Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)






share|improve this answer























  • As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
    – Rafael Valero
    Apr 4 at 16:40



















2














Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:



sudo nmap -P0 your_server_ip


You can get an answer like this:



Host is up (0.052s latency).
Not shown: 997 filtered ports
PORT STATE SERVICE
22/tcp open ssh
80/tcp open http
443/tcp closed https


If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).



Important: Note that with this configuration anyone can have access to your database



enter image description here






share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7159737%2fgetting-mongodb-on-linux-to-listen-to-remote-connections%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    5 Answers
    5






    active

    oldest

    votes








    5 Answers
    5






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    20















    1. Run netstat -a on mongo server and check a port.

    2. Check DNS settings and check that linux server allows external connections.

    3. Check that mongodb can accept external/remote connection.


    Default port for mongo is 27017.
    28017 - port for webstats.



    See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports






    share|improve this answer





















    • @user315648 Any changes?
      – Andrej Ludinovskov
      Aug 23 '11 at 14:57






    • 6




      My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
      – absynce
      Apr 18 '14 at 18:57










    • Sometimes, the server needs to be restarted for the change to take effect.
      – Arthur
      Dec 30 '15 at 21:56
















    20















    1. Run netstat -a on mongo server and check a port.

    2. Check DNS settings and check that linux server allows external connections.

    3. Check that mongodb can accept external/remote connection.


    Default port for mongo is 27017.
    28017 - port for webstats.



    See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports






    share|improve this answer





















    • @user315648 Any changes?
      – Andrej Ludinovskov
      Aug 23 '11 at 14:57






    • 6




      My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
      – absynce
      Apr 18 '14 at 18:57










    • Sometimes, the server needs to be restarted for the change to take effect.
      – Arthur
      Dec 30 '15 at 21:56














    20












    20








    20







    1. Run netstat -a on mongo server and check a port.

    2. Check DNS settings and check that linux server allows external connections.

    3. Check that mongodb can accept external/remote connection.


    Default port for mongo is 27017.
    28017 - port for webstats.



    See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports






    share|improve this answer













    1. Run netstat -a on mongo server and check a port.

    2. Check DNS settings and check that linux server allows external connections.

    3. Check that mongodb can accept external/remote connection.


    Default port for mongo is 27017.
    28017 - port for webstats.



    See http://www.mongodb.org/display/DOCS/Security+and+Authentication#SecurityandAuthentication-Ports







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Aug 23 '11 at 12:50









    Andrej Ludinovskov

    6,55911219




    6,55911219












    • @user315648 Any changes?
      – Andrej Ludinovskov
      Aug 23 '11 at 14:57






    • 6




      My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
      – absynce
      Apr 18 '14 at 18:57










    • Sometimes, the server needs to be restarted for the change to take effect.
      – Arthur
      Dec 30 '15 at 21:56


















    • @user315648 Any changes?
      – Andrej Ludinovskov
      Aug 23 '11 at 14:57






    • 6




      My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
      – absynce
      Apr 18 '14 at 18:57










    • Sometimes, the server needs to be restarted for the change to take effect.
      – Arthur
      Dec 30 '15 at 21:56
















    @user315648 Any changes?
    – Andrej Ludinovskov
    Aug 23 '11 at 14:57




    @user315648 Any changes?
    – Andrej Ludinovskov
    Aug 23 '11 at 14:57




    6




    6




    My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
    – absynce
    Apr 18 '14 at 18:57




    My issue was #3. It was due to the Bind IP set to 127.0.0.1 as @Yves M. describes in his answer.
    – absynce
    Apr 18 '14 at 18:57












    Sometimes, the server needs to be restarted for the change to take effect.
    – Arthur
    Dec 30 '15 at 21:56




    Sometimes, the server needs to be restarted for the change to take effect.
    – Arthur
    Dec 30 '15 at 21:56













    79














    1. Bind IP option



    Bind IP is a MongoDB option that restricts connections to specifics IPs.



    Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:




    1. Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.

    2. Remove or comment (with # character) the bind_ip line. But be aware that all remote connection will be able to connect your MongoDB server!


    More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp



    Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip



    2. Firewall



    Check that you are not running behind a firewall






    share|improve this answer



















    • 2




      Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
      – Abraham Philip
      Jan 17 '15 at 12:50










    • I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
      – Temak
      Jul 8 '16 at 12:52


















    79














    1. Bind IP option



    Bind IP is a MongoDB option that restricts connections to specifics IPs.



    Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:




    1. Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.

    2. Remove or comment (with # character) the bind_ip line. But be aware that all remote connection will be able to connect your MongoDB server!


    More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp



    Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip



    2. Firewall



    Check that you are not running behind a firewall






    share|improve this answer



















    • 2




      Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
      – Abraham Philip
      Jan 17 '15 at 12:50










    • I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
      – Temak
      Jul 8 '16 at 12:52
















    79












    79








    79






    1. Bind IP option



    Bind IP is a MongoDB option that restricts connections to specifics IPs.



    Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:




    1. Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.

    2. Remove or comment (with # character) the bind_ip line. But be aware that all remote connection will be able to connect your MongoDB server!


    More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp



    Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip



    2. Firewall



    Check that you are not running behind a firewall






    share|improve this answer














    1. Bind IP option



    Bind IP is a MongoDB option that restricts connections to specifics IPs.



    Have a look at your mongod configuration file, most of the time bind_ip is set to 127.0.0.1 for obvious security reasons. You can:




    1. Add your desired IP by concatenating a list of comma separated values to bind MongoDB to multiple IP addresses.

    2. Remove or comment (with # character) the bind_ip line. But be aware that all remote connection will be able to connect your MongoDB server!


    More about bind_ip configuration option: https://docs.mongodb.com/manual/reference/configuration-options/#net.bindIp



    Bind IP can also be set as a command argument: http://docs.mongodb.org/manual/reference/program/mongod/#cmdoption--bind_ip



    2. Firewall



    Check that you are not running behind a firewall







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Jul 6 at 14:44

























    answered Sep 12 '13 at 16:41









    Yves M.

    18.1k116897




    18.1k116897








    • 2




      Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
      – Abraham Philip
      Jan 17 '15 at 12:50










    • I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
      – Temak
      Jul 8 '16 at 12:52
















    • 2




      Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
      – Abraham Philip
      Jan 17 '15 at 12:50










    • I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
      – Temak
      Jul 8 '16 at 12:52










    2




    2




    Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
    – Abraham Philip
    Jan 17 '15 at 12:50




    Should have been chosen as the correct answer. Pinpoints the issue and explains it too.
    – Abraham Philip
    Jan 17 '15 at 12:50












    I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
    – Temak
    Jul 8 '16 at 12:52






    I would clarify that to be bale to accept connections on specific network adapter you must set bind_ip to the IP of this network adapter. This is not a filter for incoming connections!
    – Temak
    Jul 8 '16 at 12:52













    31














    Make sure in your /etc/mongodb.conf file you have the following line,



    bind_ip = 0.0.0.0


    http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html






    share|improve this answer



















    • 6




      This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
      – seanmakesgames
      Oct 13 '14 at 18:50








    • 4




      Really BAD idea, specially with new vulnerability when using mongo.
      – Rick
      Jan 27 '16 at 1:57






    • 3




      Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
      – victorkurauchi
      Jun 7 '16 at 16:26










    • the correct file name is "/etc/mongod.conf"
      – Omidam81
      Jul 28 '16 at 20:19










    • I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
      – newman
      Feb 28 '17 at 1:29
















    31














    Make sure in your /etc/mongodb.conf file you have the following line,



    bind_ip = 0.0.0.0


    http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html






    share|improve this answer



















    • 6




      This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
      – seanmakesgames
      Oct 13 '14 at 18:50








    • 4




      Really BAD idea, specially with new vulnerability when using mongo.
      – Rick
      Jan 27 '16 at 1:57






    • 3




      Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
      – victorkurauchi
      Jun 7 '16 at 16:26










    • the correct file name is "/etc/mongod.conf"
      – Omidam81
      Jul 28 '16 at 20:19










    • I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
      – newman
      Feb 28 '17 at 1:29














    31












    31








    31






    Make sure in your /etc/mongodb.conf file you have the following line,



    bind_ip = 0.0.0.0


    http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html






    share|improve this answer














    Make sure in your /etc/mongodb.conf file you have the following line,



    bind_ip = 0.0.0.0


    http://jitu-blog.blogspot.com.br/2013/06/allow-mongo-to-connect-from-remote-ip.html







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 22 at 23:40









    Yves M.

    18.1k116897




    18.1k116897










    answered Jul 17 '14 at 3:21









    victorkurauchi

    8491019




    8491019








    • 6




      This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
      – seanmakesgames
      Oct 13 '14 at 18:50








    • 4




      Really BAD idea, specially with new vulnerability when using mongo.
      – Rick
      Jan 27 '16 at 1:57






    • 3




      Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
      – victorkurauchi
      Jun 7 '16 at 16:26










    • the correct file name is "/etc/mongod.conf"
      – Omidam81
      Jul 28 '16 at 20:19










    • I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
      – newman
      Feb 28 '17 at 1:29














    • 6




      This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
      – seanmakesgames
      Oct 13 '14 at 18:50








    • 4




      Really BAD idea, specially with new vulnerability when using mongo.
      – Rick
      Jan 27 '16 at 1:57






    • 3




      Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
      – victorkurauchi
      Jun 7 '16 at 16:26










    • the correct file name is "/etc/mongod.conf"
      – Omidam81
      Jul 28 '16 at 20:19










    • I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
      – newman
      Feb 28 '17 at 1:29








    6




    6




    This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
    – seanmakesgames
    Oct 13 '14 at 18:50






    This is a bad idea from a configuration perspective. You'll achieve the same result from commenting out the bind_ip line. I would encourage comma separating the specific private or public ips of your server: 127.0.0.1,10.x.x.x
    – seanmakesgames
    Oct 13 '14 at 18:50






    4




    4




    Really BAD idea, specially with new vulnerability when using mongo.
    – Rick
    Jan 27 '16 at 1:57




    Really BAD idea, specially with new vulnerability when using mongo.
    – Rick
    Jan 27 '16 at 1:57




    3




    3




    Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
    – victorkurauchi
    Jun 7 '16 at 16:26




    Yes, it's a BAD idea working with production environment. This setting would be 'acceptable' if env=development. be careful
    – victorkurauchi
    Jun 7 '16 at 16:26












    the correct file name is "/etc/mongod.conf"
    – Omidam81
    Jul 28 '16 at 20:19




    the correct file name is "/etc/mongod.conf"
    – Omidam81
    Jul 28 '16 at 20:19












    I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
    – newman
    Feb 28 '17 at 1:29




    I'm in Windows and don't see the file etc/mongod.conf. Where is it or where do i put it exactly? And I tried to put it in my mongodb.config file, but it didn't change anything.
    – newman
    Feb 28 '17 at 1:29











    7














    Just had this issue and this fixed it:



    Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):



    # network interfaces
    net:
    port: 27017
    bindIp: 0.0.0.0


    Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):



    sudo service mongod restart



    Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)






    share|improve this answer























    • As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
      – Rafael Valero
      Apr 4 at 16:40
















    7














    Just had this issue and this fixed it:



    Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):



    # network interfaces
    net:
    port: 27017
    bindIp: 0.0.0.0


    Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):



    sudo service mongod restart



    Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)






    share|improve this answer























    • As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
      – Rafael Valero
      Apr 4 at 16:40














    7












    7








    7






    Just had this issue and this fixed it:



    Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):



    # network interfaces
    net:
    port: 27017
    bindIp: 0.0.0.0


    Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):



    sudo service mongod restart



    Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)






    share|improve this answer














    Just had this issue and this fixed it:



    Edit /etc/mongod.conf with sudo nano /etc/mongod.conf ensure that the net section looks like below (localhost binding by default doesn't allow for remote access):



    # network interfaces
    net:
    port: 27017
    bindIp: 0.0.0.0


    Make sure to restart mongod when you are done with above with below (assuming systemd ubuntu 16.04+ etc.):



    sudo service mongod restart



    Obviously from a security perspective if you are going to be opening up mongo to your network/the world be aware of the implications of this (if any)







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 20 at 21:24

























    answered Dec 18 '17 at 2:21









    John Culviner

    14.9k33943




    14.9k33943












    • As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
      – Rafael Valero
      Apr 4 at 16:40


















    • As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
      – Rafael Valero
      Apr 4 at 16:40
















    As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
    – Rafael Valero
    Apr 4 at 16:40




    As in previous post as been point out, you should also make the port 27017, in this case, available. Also you may have security issue, to reduce them you could, as just mentioned, restrict the IPs accesible to the port and/or create a user with a password. I have gone through this recently I make some notes of the whole process here: incredulosanonimos.blogspot.co.uk/2018/04/….
    – Rafael Valero
    Apr 4 at 16:40











    2














    Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:



    sudo nmap -P0 your_server_ip


    You can get an answer like this:



    Host is up (0.052s latency).
    Not shown: 997 filtered ports
    PORT STATE SERVICE
    22/tcp open ssh
    80/tcp open http
    443/tcp closed https


    If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).



    Important: Note that with this configuration anyone can have access to your database



    enter image description here






    share|improve this answer




























      2














      Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:



      sudo nmap -P0 your_server_ip


      You can get an answer like this:



      Host is up (0.052s latency).
      Not shown: 997 filtered ports
      PORT STATE SERVICE
      22/tcp open ssh
      80/tcp open http
      443/tcp closed https


      If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).



      Important: Note that with this configuration anyone can have access to your database



      enter image description here






      share|improve this answer


























        2












        2








        2






        Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:



        sudo nmap -P0 your_server_ip


        You can get an answer like this:



        Host is up (0.052s latency).
        Not shown: 997 filtered ports
        PORT STATE SERVICE
        22/tcp open ssh
        80/tcp open http
        443/tcp closed https


        If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).



        Important: Note that with this configuration anyone can have access to your database



        enter image description here






        share|improve this answer














        Another problem may be that the mongodb port is not enabled. Check, from another host, the ports enabled on your server. For that you can use the command:



        sudo nmap -P0 your_server_ip


        You can get an answer like this:



        Host is up (0.052s latency).
        Not shown: 997 filtered ports
        PORT STATE SERVICE
        22/tcp open ssh
        80/tcp open http
        443/tcp closed https


        If you use a virtual server in the cloud, as AWS, you need to add a new rule to add mongodb port (27017 by default).



        Important: Note that with this configuration anyone can have access to your database



        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Mar 24 '16 at 22:23

























        answered Mar 23 '16 at 16:18









        J.C. Gras

        1,3681317




        1,3681317






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f7159737%2fgetting-mongodb-on-linux-to-listen-to-remote-connections%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Lallio

            Unable to find Lightning Node

            Futebolista