Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Describe your changes
This introduces a network monitor feature that automatically restarts our engine in response to significant changes in network configurations.
The network monitor is disabled by default and can be enabled by passing the flag
--network-monitor
to thenetbird up
commandUpon engine startup, the network monitor collects the current default IPv4 and/or IPv6 route's next hop and associated interfaces. It then actively monitors network changes that require an engine restart. The triggers for these restarts vary by operating system:
Linux:
BSD (including macOS):
Windows:
Testing
To ensure the Network Watcher functions correctly across different platforms, follow these OS-specific testing steps:
Linux:
ip link set <interface> down
, restore withip link set <interface> up
ip route replace default via <new-ip>
and restore withip route replace default via <old-ip>
ip route add default via <some-other-ip> metric 100
, restore withip route delete default via <some-other-ip> metric 100
ip route delete default
, restore withip route add default via <old-params>
BSD (including macOS):
ifconfig <interface> down
, restore withifonfig <interface> up
route change default <new-ip>
, restore withroute change default <old-ip>
route add default <new-ip>
, restore withroute delete default <new-ip>
route delete default
, restore withroute add default <old-params>
Windows:
route change 0.0.0.0/0 <new-gateway>
and restore withroute change 0.0.0.0/0 <old-gateway>
route add 0.0.0.0/0 <new-gateway> metric 1
and restore withroute delete 0.0.0.0/0 <new-gateway>
arp -d <gateway IP>
In all cases, you can simulate a network switch (e.g., from local WiFi to Ethernet or a mobile hotspot) to trigger the network watcher and observe the engine's response.
Issue ticket number and link
Checklist