[JAVA-4506] Allow specification of outgoing address Created: 21/Feb/22  Updated: 27/Oct/23  Resolved: 16/Mar/22

Status: Closed
Project: Java Driver
Component/s: Configuration, Connection Management
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Unknown
Reporter: Michael Bauland Assignee: Jeffrey Yemin
Resolution: Gone away Votes: 0
Labels: external-user
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

While I can define to which mongodb I want to connect, there is currently no way to define from which IP address I want to establish the connection.

It would be good to be able to define (either directly via parameter of the MongoClient constructor or within the MongoClientOptions) to which local IP the connection should bind to.



 Comments   
Comment by PM Bot [ 16/Mar/22 ]

There hasn't been any recent activity on this ticket, so we're resolving it. Thanks for reaching out! Please feel free to comment on this if you're able to provide more information.

Comment by Jeffrey Yemin [ 01/Mar/22 ]

Hi michaelbaulandknipp@gmail.com

I see that the Java Socket API supports this but the driver does not expose the configuration options necessary to take advantage of that API. In fact, none of our MongoDB drivers in any language support this, and this is the first request we've ever had for this feature. We are not inclined to implement it until we get signal that this is a more generally useful feature.

Given that you're the first to ask for this configuration, it seems reasonable to figure out why that is. Maybe you're doing something that is quite unusual, and there are alternative solutions you could implement outside of the driver that would solve the problem for you.

My colleague james.kovacs wrote this to me when I asked him about it:

Typically when you’ve got multiple NICs, you’re in one of two situations:

  • One NIC is internal, one external. It’s quite obvious which one is needed to reach a particular destination IP.
  • Multiple NICs are load balancing for higher throughput. All NICs can see all destination IPs and you want to round-robin between them. You let the OS take care of that.

It’s an odd setup to have multiple NICs that can all route to a particular CIDR block, but you firewall some of them and must use particular ones for traffic.

Comment by Stennie Steneker (Inactive) [ 21/Feb/22 ]

Related discussion in the Community Forums: https://www.mongodb.com/community/forums/t/how-to-specify-an-outgoing-address-in-java-mongoclient/147950?u=stennie

Generated at Thu Feb 08 09:02:15 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.