[GH-ISSUE #2087] bind_addr isn't implemented #880

Open
opened 2026-03-16 00:44:19 +03:00 by kerem · 3 comments
Owner

Originally created by @caobug on GitHub (Nov 5, 2023).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2087

Hello, it seems that bind_addr in NameServerConfig is not implemented. I'd like to modify it, but I'm not sure if there are other considerations.

bind_addr is especially important when the device contains many IP addresses.

For example: There are 2 IP addresses in the device, one of which has a default route set, and sometimes I need to connect through the other IP.

https://github.com/hickory-dns/hickory-dns/blob/main/crates/proto/src/udp/udp_stream.rs#L268

Originally created by @caobug on GitHub (Nov 5, 2023). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2087 Hello, it seems that `bind_addr` in `NameServerConfig` is not implemented. I'd like to modify it, but I'm not sure if there are other considerations. `bind_addr` is especially important when the device contains many IP addresses. For example: There are 2 IP addresses in the device, one of which has a default route set, and sometimes I need to connect through the other IP. https://github.com/hickory-dns/hickory-dns/blob/main/crates/proto/src/udp/udp_stream.rs#L268
Author
Owner

@bluejekyll commented on GitHub (Nov 5, 2023):

I think this would be great. I guess I don't know which is the correct location to set this, whether it's NameServerConfig or on the entire ResolverConfig and it would be used for all NameServer connections. I can see the value in making it possible to bind on a per name server basis, but that will be more complex to configure. For folks that want to bind to different addresses on a per Nameserver basis, perhaps, a new resolver could be constructed?

<!-- gh-comment-id:1793592209 --> @bluejekyll commented on GitHub (Nov 5, 2023): I think this would be great. I guess I don't know which is the correct location to set this, whether it's `NameServerConfig` or on the entire `ResolverConfig` and it would be used for all NameServer connections. I can see the value in making it possible to bind on a per name server basis, but that will be more complex to configure. For folks that want to bind to different addresses on a per Nameserver basis, perhaps, a new resolver could be constructed?
Author
Owner

@caobug commented on GitHub (Nov 5, 2023):

We have to take into account that the target DNS has different families, so I think it is better to directly implement the bind_addr option in NameServerConfig.

looks like:

socket_addr = "8.8.8.8:53"
protocol = "udp"
trust_negative_responses = true
bind_addr = "192.168.0.100:0"

socket_addr = "[::1]:53"
protocol = "udp"
trust_negative_responses = true
bind_addr = "[::1]:0"
<!-- gh-comment-id:1793611538 --> @caobug commented on GitHub (Nov 5, 2023): We have to take into account that the target DNS has different families, so I think it is better to directly implement the bind_addr option in NameServerConfig. looks like: ``` socket_addr = "8.8.8.8:53" protocol = "udp" trust_negative_responses = true bind_addr = "192.168.0.100:0" socket_addr = "[::1]:53" protocol = "udp" trust_negative_responses = true bind_addr = "[::1]:0" ```
Author
Owner

@bluejekyll commented on GitHub (Nov 5, 2023):

That seems reasonable, and localhost vs. remote is a good example. Should we just drop the port on the bind_addr though? It seems like it will always be 0, right?

<!-- gh-comment-id:1793809201 --> @bluejekyll commented on GitHub (Nov 5, 2023): That seems reasonable, and localhost vs. remote is a good example. Should we just drop the port on the bind_addr though? It seems like it will always be `0`, right?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#880
No description provided.