Mongod service fails when second ip added

I’d like to allow connections from only local host and my frontend server so when adding the ip of my front end server, the mongod service fails to start from local host every time.


network interfaces

port: 27017

status error:
● mongod.service - MongoDB Database Server
Loaded: loaded (/lib/systemd/system/mongod.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sun 2019-10-13 13:51:04 UTC; 7s ago
Process: 5961 ExecStart=/usr/bin/mongod --config /etc/mongod.conf (code=exited, status=48)
Main PID: 5961 (code=exited, status=48)

When I remove the second ip address, it works fine.

I noticed a comment on stack overflow that mentioned the following: (for the life of me, though, i don’t see a typo)
One thing I did find is that you can’t bind to an IP that isn’t bound to an interface. The mongod service simply won’t start if you typo the IP. – technicallynick [Oct 25 '18 at 18:19]

Any help is greatly appreciated.

Are you running the command on your localhost or vagrant?
What does ping localhost show?

1 Like

Command was run on localhost.

I added the A record for the subdomain to point to the back end server it started working. I’m not sure if this was related or not. I also hadn’t added Nginx Full to the firewall settings yet so I wonder if that had anything to do with it.

Thanks for your help! I suppose the issue has been resolved (just not sure which steps I took on the side that fixed it).