Last active
February 10, 2026 11:36
-
-
Save malikbenkirane/f9ed53dac24267fc660b6810d85faba7 to your computer and use it in GitHub Desktop.
Wireguard Wg-quick
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
| [Interface] | |
| Address = # e.g. 10.20.10.2/24 | |
| ListenPort = 33333 | |
| DNS = 8.8.8.8 | |
| PrivateKey = # ... | |
| [Peer] | |
| PublicKey = # server.conf public key | |
| Endpoint = # server IP:PORT | |
| AllowedIPs = # e.g. 10.20.10.0/24 or 0.0.0.0/0 |
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
| sudo vi /etc/wireguard/wg0.conf | |
| sudo systemctl start wg-quick@wg0 # first time and after reboot | |
| sudo systemctl enable wg-quick@wg0 # persist after reboot (no need to run start command) | |
| sudo systemctl reload wg-quick@wg0 # reload server/peers configuration |
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
| # /etc/wireguard/wg0.conf | |
| [Interface] | |
| Address = # e.g. 10.20.10.1/24 | |
| ListenPort = 33333 | |
| PrivateKey = $(wg genkey) | |
| PostUp = iptables -A FORWARD -i %i -j ACCEPT | |
| PostUp = iptables -A FORWARD -o %i -j ACCEPT | |
| PostUp = iptables -t nat -A POSTROUTING -o ens4 -j MASQUERADE | |
| PostDown = iptables -D FORWARD -i %i -j ACCEPT | |
| PostDown = iptables -D FORWARD -o %i -j ACCEPT | |
| PostDown = iptables -t nat -D POSTROUTING -o ens4 -j MASQUERADE | |
| [Peer] | |
| PublicKey = # ... | |
| AllowedIPs = # e.g. 10.20.10.2/32 | |
| # ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment