Skip to content

Add UFW configuration to the wireguard internal docs - #1205

Open
Beagon wants to merge 3 commits into
pi-hole:masterfrom
Beagon:patch-1
Open

Add UFW configuration to the wireguard internal docs#1205
Beagon wants to merge 3 commits into
pi-hole:masterfrom
Beagon:patch-1

Conversation

@Beagon

@Beagon Beagon commented Mar 10, 2025

Copy link
Copy Markdown

Thank you for your contribution to the Pi-hole Community!

Please read the comments below to help us consider your Pull Request.

We are all volunteers and completing the process outlined will help us review your commits quicker.

Please make sure you

  1. Base your code and PRs against the repositories developmental branch.
  2. Sign Off all commits as we enforce the DCO for all contributions
  3. Sign all your commits as they must have verified signatures
  4. File a pull request for any change that requires changes to our documentation at our documentation repo

What does this PR aim to accomplish?:

Add UFW configuration to the documentation as I had issues with UFW and it wasn't mentioned anywhere.

How does this PR accomplish the above?:

Add the correct documentation to make it work.

Link documentation PRs if any are needed to support this PR:


By submitting this pull request, I confirm the following:

  1. I have read and understood the contributors guide, as well as this entire template. I understand which branch to base my commits and Pull Requests against.
  2. I have commented my proposed changes within the code and I have tested my changes.
  3. I am willing to help maintain this change if there are issues with it later.
  4. It is compatible with the EUPL 1.2 license
  5. I have squashed any insignificant commits. (git rebase)
  6. I have checked that another pull request for this purpose does not exist.
  7. I have considered, and confirmed that this submission will be valuable to others.
  8. I accept that this submission may not be used, and the pull request closed at the will of the maintainer.
  9. I give this submission freely, and claim no ownership to its content.

  • I have read the above and my PR is ready for review. Check this box to confirm

Signed-off-by: Robin Rijkeboer <robin@richblox.nl>
@netlify

netlify Bot commented Mar 10, 2025

Copy link
Copy Markdown

Deploy Preview for pihole-docs ready!

Name Link
🔨 Latest commit feac848
🔍 Latest deploy log https://app.netlify.com/sites/pihole-docs/deploys/67cf4192c6ba4200080bffe8
😎 Deploy Preview https://deploy-preview-1205--pihole-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Signed-off-by: Robin Rijkeboer <robin@richblox.nl>
@yubiuser
yubiuser requested a review from DL6ER March 10, 2025 19:50

@DL6ER DL6ER left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for filling this gap - UFW's default DEFAULT_FORWARD_POLICY=DROP really does bite people here, and it is not documented anywhere else. A few things to sort before we merge, one of them blocking:

  • Wrong IPv4 subnet (blocking). The new rules use 10.10.10.0/24, but this whole guide uses 10.100.0.0/24 for the WireGuard-internal range (server 10.100.0.1/24, clients 10.100.0.2/32, DNS = 10.100.0.1). The IPv6 rule correctly reuses fd08:4711::/64, which makes the IPv4 value stand out as a leftover from your own network. As written, someone copy-pasting allows forwarding for a subnet they never use and the tunnel still will not route.
  • Framing. The nftables/iptables masquerade rules above still work under UFW - UFW additionally drops forwarded packets, so this step is in addition to the NAT config, not a replacement. "the above doesn't work" reads as if it were a third alternative to the NAT methods.
  • Small stuff. COMMIT is an uppercase literal in these files (the IPv4 paragraph lowercases it), and sudo systemctl restart ufw (or sudo ufw reload) would match the rest of the guide.

Left inline notes on the specific lines.


### `ufw`

If you are using UFW the above doesn't work and you will need to edit `/etc/ufw/before.rules`:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

UFW does not replace the NAT rules above - the nftables/iptables masquerade still runs; UFW just drops forwarded packets on top of it. Could we reword along the lines of:

UFW drops forwarded packets by default, so in addition to the NAT rules above you need to allow forwarding for the tunnel subnet by editing /etc/ufw/before.rules:

As-is, "the above doesn't work" reads as if UFW were an alternative to the nftables/iptables method rather than an extra step on top of it.

Comment on lines +96 to +97
-A ufw-before-forward -s 10.10.10.0/24 -j ACCEPT
-A ufw-before-forward -d 10.10.10.0/24 -j ACCEPT

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: this guide uses 10.100.0.0/24 for the WireGuard-internal IPv4 range everywhere else (10.100.0.1/24, 10.100.0.2/32, DNS = 10.100.0.1). 10.10.10.0/24 looks like a leftover from your own network - a reader copy-pasting it allows forwarding for a subnet they do not use, so forwarding still fails. Please change both lines to 10.100.0.0/24. The IPv6 rule below already reuses the guide's fd08:4711::/64, so only the IPv4 side needs the fix.


If you are using UFW the above doesn't work and you will need to edit `/etc/ufw/before.rules`:

Insert this into the before.rules file but **before** the FIRST commit line:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

COMMIT is an uppercase literal directive in before.rules, but it is written as lowercase "commit" here while the IPv6 paragraph below writes "COMMIT". Let us use COMMIT in both places so it is consistent and matches what a reader actually greps for in the file.

-A ufw6-before-forward -d fd08:4711::/64 -j ACCEPT
```

Restart ufw for the changes to take effect: `systemctl restart ufw`

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The rest of the guide prefixes root commands with sudo; sudo systemctl restart ufw (or the more idiomatic sudo ufw reload) would match.

@DL6ER
DL6ER requested a review from a team as a code owner July 26, 2026 18:05
@netlify

netlify Bot commented Jul 26, 2026

Copy link
Copy Markdown

Deploy Preview for pihole-docs ready!

Name Link
🔨 Latest commit d09cc2c
🔍 Latest deploy log https://app.netlify.com/projects/pihole-docs/deploys/6a664c64a3a89700085f2d10
😎 Deploy Preview https://deploy-preview-1205--pihole-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

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

Successfully merging this pull request may close these issues.

2 participants