[PR #4707] [client] Redirect dns forwarder port 5353 to new listening port 22054 #4367

Open
opened 2025-11-20 08:08:15 -05:00 by saavagebueno · 0 comments
Owner

Original Pull Request: https://github.com/netbirdio/netbird/pull/4707

State: closed
Merged: Yes


Describe your changes

  • Port dnat changes from https://github.com/netbirdio/netbird/pull/4015 (nftables/iptables/userspace)
    • For userspace: rewrite the original port to the target port
    • Remember original destination port in conntrack
    • Rewrite the source port back to the original port for replies
  • Redirect incoming port 5353 to 22054 (tcp/udp)
  • Revert port changes based on the network map received from management
  • Adjust tracer to show NAT stages

Example tracer output

$ netbird debug trace in 100.0.169.249 self -p tcp --dport 5353
Packet trace 100.0.169.249:49561 → self:5353 (TCP)

Received: Received TCP packet: 100.0.169.249:49561 -> 100.0.2.175:5353
Inbound Port DNAT: TCP port DNAT applied: 100.0.2.175:5353 -> 100.0.2.175:22054
Inbound 1:1 NAT: 1:1 NAT not enabled
Connection Tracking: No existing connection found
Routing: Packet destined for local delivery
Peer ACL: Allowed by peer ACL rules (<no id>)
Completed: Processing completed

Final disposition: ALLOWED

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

**Original Pull Request:** https://github.com/netbirdio/netbird/pull/4707 **State:** closed **Merged:** Yes --- ## Describe your changes - Port dnat changes from https://github.com/netbirdio/netbird/pull/4015 (nftables/iptables/userspace) - For userspace: rewrite the original port to the target port - Remember original destination port in conntrack - Rewrite the source port back to the original port for replies - Redirect incoming port 5353 to 22054 (tcp/udp) - Revert port changes based on the network map received from management - Adjust tracer to show NAT stages Example tracer output ``` $ netbird debug trace in 100.0.169.249 self -p tcp --dport 5353 Packet trace 100.0.169.249:49561 → self:5353 (TCP) Received: Received TCP packet: 100.0.169.249:49561 -> 100.0.2.175:5353 Inbound Port DNAT: TCP port DNAT applied: 100.0.2.175:5353 -> 100.0.2.175:22054 Inbound 1:1 NAT: 1:1 NAT not enabled Connection Tracking: No existing connection found Routing: Packet destined for local delivery Peer ACL: Allowed by peer ACL rules (<no id>) Completed: Processing completed Final disposition: ALLOWED ``` ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [x] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__
saavagebueno added the pull-request label 2025-11-20 08:08:15 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: SVI/netbird#4367