Wireguard: Remove duplicated iptables POSTROUTING masquerade #516

Closed
opened 2026-02-04 19:26:10 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @Tunebox1 on GitHub (Feb 18, 2025).

Originally assigned to: @tremor021 on GitHub.

🌟 Briefly describe the feature

Masquerade should be only in POSTUP POSTDOWN and duplicated not in POSTROUTING

📝 Detailed description

  • remove iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE from script
  • masquerade is already in the wg0.conf postup and postdown, making it duplicated and harder to debug if you dont want to masquerade

💡 Why is this useful?

The Script is setting a masquerade aftert installing wireguard iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE while this is working as intended - for users that do not want to have MASQUERADE, this makes it harder to debug.

  1. This is duplicated, its in the postup postdown and also in the iptables
  2. Making it hard to debug / find the issue if you want to disable MASQUERADE:
    If you check the wg0.conf, you can find the MASQUERADE. If you check on the CLI with wg-quick up wg-quick down, you also can find it. So you delete it, thnking you wont doe masuqerade anymore but its still doing it. Only if you now check the iptables as an addition you can find it.

If you install Wireguard manually this is also not set so i think if you decide to set it by default (which i can understand since most users might want that), ONLY put it in the POSTUP and POSTDOWN.

Originally created by @Tunebox1 on GitHub (Feb 18, 2025). Originally assigned to: @tremor021 on GitHub. ### 🌟 Briefly describe the feature Masquerade should be only in POSTUP POSTDOWN and duplicated not in POSTROUTING ### 📝 Detailed description - remove `iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE` from script - masquerade is already in the wg0.conf postup and postdown, making it duplicated and harder to debug if you dont want to masquerade ### 💡 Why is this useful? The Script is setting a masquerade aftert installing wireguard `iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE` while this is working as intended - for users that do not want to have MASQUERADE, this makes it harder to debug. 1. This is duplicated, its in the postup postdown and also in the iptables 2. Making it hard to debug / find the issue if you want to disable MASQUERADE: If you check the wg0.conf, you can find the MASQUERADE. If you check on the CLI with `wg-quick up` `wg-quick down`, you also can find it. So you delete it, thnking you wont doe masuqerade anymore but its still doing it. Only if you now check the iptables as an addition you can find it. If you install Wireguard manually this is also not set so i think if you decide to set it by default (which i can understand since most users might want that), ONLY put it in the POSTUP and POSTDOWN.
OVERLORD added the enhancement label 2026-02-04 19:26:10 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/ProxmoxVE#516