[PR #4866] feat(client): auto-reconfigure WireGuard interface on peer IP change #21450

Open
opened 2026-08-05 05:08:31 -04:00 by saavagebueno · 0 comments
Owner

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

State: open
Merged: No


Added

  • Automatic WireGuard interface reconfiguration when peer IP changes
  • The NetBird client now detects changes to the self peer’s IP address delivered by the Management Service and applies them live without requiring netbird down / netbird up. This is a more scalable approach for someone who has many peers and impossible to restart 1 by 1.

Improved

  • Enhanced client engine logic to watch for self-IP updates from network map diffs.
  • Added logic to update interface address, routes, and internal state when the IP changes.
  • Reduced downtime during CIDR migrations and tenant-level IP reassignment.
  • Improved consistency between Management-assigned IPs and the active local WireGuard configuration.

Fixed

  • Fixed issue where the client received new IP configuration from Management but did not reconfigure the local interface until a manual reconnect.
  • Fixed mismatch between API IP and active wtX/utunX interface, resulting in routing inconsistencies.

Notes

  • Implementation tested on macOS and Linux client builds.
  • WG interface name handling remains platform-specific:
  • macOS uses utun*
  • Linux uses wg0 / kernel interface path

This enhancement significantly improves NetBird’s dynamic IP behavior and avoids downtime during network CIDR changes.

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)

Summary by CodeRabbit

  • New Features

    • Hot-update of the local WireGuard IP during config changes.
    • Automatic SSH rebind and firewall DNAT refresh when the node IP changes.
    • Local IP state is refreshed to reflect address changes.
  • Bug Fixes

    • Config updates now continue if an IP update fails; failures are logged rather than aborting.
  • Tests

    • Added tests for IP-update scenarios, SSH restart lifecycle, and firewall/DNAT interactions.

✏️ Tip: You can customize this high-level summary in your review settings.

**Original Pull Request:** https://github.com/netbirdio/netbird/pull/4866 **State:** open **Merged:** No --- ### Added - Automatic WireGuard interface reconfiguration when peer IP changes - The NetBird client now detects changes to the self peer’s IP address delivered by the Management Service and applies them live without requiring netbird down / netbird up. This is a more scalable approach for someone who has many peers and impossible to restart 1 by 1. ### Improved - Enhanced client engine logic to watch for self-IP updates from network map diffs. - Added logic to update interface address, routes, and internal state when the IP changes. - Reduced downtime during CIDR migrations and tenant-level IP reassignment. - Improved consistency between Management-assigned IPs and the active local WireGuard configuration. ### Fixed - Fixed issue where the client received new IP configuration from Management but did not reconfigure the local interface until a manual reconnect. - Fixed mismatch between API IP and active wtX/utunX interface, resulting in routing inconsistencies. ### Notes - Implementation tested on macOS and Linux client builds. - WG interface name handling remains platform-specific: - macOS uses utun* - Linux uses wg0 / kernel interface path **This enhancement significantly improves NetBird’s dynamic IP behavior and avoids downtime during network CIDR changes.** ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] Is a feature enhancement - [x] 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) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Hot-update of the local WireGuard IP during config changes. * Automatic SSH rebind and firewall DNAT refresh when the node IP changes. * Local IP state is refreshed to reflect address changes. * **Bug Fixes** * Config updates now continue if an IP update fails; failures are logged rather than aborting. * **Tests** * Added tests for IP-update scenarios, SSH restart lifecycle, and firewall/DNAT interactions. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
saavagebueno added the pull-request label 2026-08-05 05:08:31 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#21450