07-31-2023, 10:01 AM
Here I resolve this issue using bellow code. my mongod version 4.4.21.
```
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1, <your_server_ip>
bindIpAll: true
```
After Changes restart the mongod service
```
sudo service mongod restart
```
To verify the connection write bellow code in your local system terminal
```
nc -zv <your_server_ip> 27017
```
Output :
```
Connection to <your_server_ip> port 27017 [tcp/*] succeeded!
```
```
# network interfaces
net:
port: 27017
bindIp: 127.0.0.1, <your_server_ip>
bindIpAll: true
```
After Changes restart the mongod service
```
sudo service mongod restart
```
To verify the connection write bellow code in your local system terminal
```
nc -zv <your_server_ip> 27017
```
Output :
```
Connection to <your_server_ip> port 27017 [tcp/*] succeeded!
```