[SERVER-60408] Mongod cannot bind to IPv6 address Created: 02/Oct/21  Updated: 11/Oct/21  Resolved: 11/Oct/21

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Mi B Assignee: Edwin Zhou
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File mongo.log    
Operating System: ALL
Steps To Reproduce:

This needs to be running inside an IPv6 docker environment

 

docker run -d -v /Docker/entrypoint/:/usr/local/bin/ -v /Docker/mongoconfig/mongod.conf.orig:/etc/mongod.conf.orig -p 27017:27017 mongo:5.0.3

 

docker entry point modified to docker-entrypoint.sh:
 #!/bin/bash
exec mongod --bind_ip '::' --ipv6
mongod.conf.orig something along the lines of:
 storage:
dbPath: /var/lib/mongodb
journal:
enabled: true

  1. where to write logging data.
    systemLog:
    destination: file
    logAppend: true
    path: /var/log/mongodb/mongod.log
  1. network interfaces
    net:
    port: 27017
    #bindIp: 134:1234:134:1324:1234:134:1234:3
    bind_ip = 0::0
    ipv6 = true
    or an in container command along the lines of: 

mongod --dbpath ~/mongoDB --bind_ip [::] --ipv6 

 

Participants:
Story Points: 25

 Description   

 I'm running MongoDB inside the official container - however I am running docker in an IPv6 only environment. 
When changing the config or docker entry point to run with ipv6 binding docker fails to bind with the following output 

 "ctx":"initandlisten","msg":"Found no addresses for peer","attr":{"peer":

{"code":7,"codeName":"HostNotFound","errmsg":"Could not find address for [[::]]:27017: SocketException: Host not found (authoritative)"}

}}

I've tried typing the full IPv6 address, this also didn't work. It occurred to me that Mongod may be using a library to find the IPv6 address, I only have ifupdown and ifconfig installed.

Log attached. 

 



 Comments   
Comment by Edwin Zhou [ 11/Oct/21 ]

Hi mikster22@googlemail.com,

I believe the issue occurs when the square brackets are included around the "::" ip address. The square brackets are used to delimit the IPv6 address with the port number. You may specify the port number with the --port flag.I was able to start the mongod with the command:

mongod --bind_ip "::" --ipv6 --dbpath <dbpath>

Please note that the MongoDB Docker image is maintained by the Docker Community and not by MongoDB. The MongoDB SERVER project is reserved for bug reports for the MongoDB server. As this doesn't appear to be a bug, I will close this ticket. We'd like to encourage you to ask our community for help by posting on the MongoDB Developer Community Forums. If the discussion there leads you to suspect a bug in the MongoDB server, then we'd want to investigate it as a possible bug here in the SERVER project.

Best,
Edwin

Generated at Thu Feb 08 05:49:44 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.