Add support for nftables alongside iptables#1036
Draft
Copilot wants to merge 4 commits into
Draft
Conversation
|
Thanks for creating a pull request! A maintainer will review your changes shortly. Please don't be discouraged if it takes a while. |
Member
|
@copilot try again |
Co-authored-by: GoliathLabs <8057646+GoliathLabs@users.noreply.github.com>
Co-authored-by: GoliathLabs <8057646+GoliathLabs@users.noreply.github.com>
Author
I've now implemented nftables support alongside iptables. The changes include:
The implementation is in commit b09254c. The nftables backend uses netlink for direct kernel communication, so it doesn't require the nftables binary to be installed. |
Copilot
AI
changed the title
[WIP] Add support for nftables alongside iptables
Add support for nftables alongside iptables
Dec 20, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR implements nftables support as an alternative firewall backend alongside the existing iptables support, addressing the feature request for nftables compatibility.
Implementation Overview
The implementation adds a firewall abstraction layer that supports both iptables and nftables backends:
Firewallinterface ininternal/network/firewall.gothat abstracts firewall operationsgithub.com/google/nftableswith netlink for direct kernel communication (no nftables binary required)Configuration Options
Users can now choose their preferred firewall backend via:
--vpn-firewall-backend(values: auto/iptables/nftables)WG_VPN_FIREWALL_BACKENDvpn.firewallBackendThe default "auto" mode intelligently tries nftables first and gracefully falls back to iptables if nftables is unavailable.
Features
Technical Details
The nftables implementation:
wg-access-servertable for both IPv4 and IPv6github.com/google/nftableslibrary for netlink-based kernel communicationThis implementation maintains the maintainability of the codebase while providing modern nftables support for systems that prefer or require it.
Original prompt
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.