Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions to configure nftables firewall #384

Open
heitorPB opened this issue Sep 17, 2020 · 2 comments
Open

Add instructions to configure nftables firewall #384

heitorPB opened this issue Sep 17, 2020 · 2 comments

Comments

@heitorPB
Copy link

The current documentation about prerequisites - firewalls describes how to use IPTables, FirewallD, and ufw. nftables is the "modern" version of IPTables and is not in the guide.

It would be nice to have official instructions for setting nftables up.

@yubiuser
Copy link
Member

Thanks for the suggestion. Do you feel capable of writing the instructions and submitting a PR?

@alfalfascout
Copy link

The commands I used for nftables are as follows.

NFTables (IPv4)

nft insert rule ip filter INPUT ip saddr 192.168.0.0/16 tcp dport 80 counter accept
nft insert rule ip filter INPUT ip saddr 127.0.0.0/8 tcp dport 53 counter accept
nft insert rule ip filter INPUT ip saddr 127.0.0.0/8 udp dport 53 counter accept
nft insert rule ip filter INPUT ip saddr 192.168.0.0/16 tcp dport 53 counter accept
nft insert rule ip filter INPUT ip saddr 192.168.0.0/16 udp dport 53 counter accept
nft insert rule ip filter INPUT udp sport 67-68 udp dport 67-68 counter accept
nft insert rule ip filter INPUT iifname "lo" tcp dport 4711 counter accept
nft insert rule ip filter INPUT ct state related,established counter accept

If the above commands don't work (no such file or directory), run these, then try again:

nft add table ip filter
nft add chain ip filter INPUT { type filter hook input priority 0 \; }

NFTables (IPv6)

nft insert rule ip6 filter INPUT udp sport 546-547 udp dport 546-547 counter accept
nft insert rule ip6 filter INPUT ct state related,established counter accept

If the above commands don't work (no such file or directory), run these, then try again:

nft add table ip6 filter
nft add chain ip6 filter INPUT { type filter hook input priority 0 \; }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants