127.0.0.1 typically refers to loopback local-only terminal
0.0.0.0 depending on the context, this typically instructs an application to listen on every available interface.
Example:
With following MongoDB configuration
1 2 3 |
net: port: 27017 bindIp: 127.0.0.1 |
Mongo will be available only locally. Even if you open port 27017 on all interfaces, Mongo won’t be available on these ports and to anyone from outside world it will appear as if on port 27017
On the other hand, if we change 127.0.0.1 to 0.0.0.0
1 2 3 |
net: port: 27017 bindIp: 0.0.0.0 |
Mongo will be listening on port 27017 on all network interfaces.