Skip to content

Instantly share code, notes, and snippets.

@amanjuman
Created September 30, 2023 10:16
Show Gist options
  • Save amanjuman/ff81e23bccd3d14cc04a8fe1bd0319b6 to your computer and use it in GitHub Desktop.
Save amanjuman/ff81e23bccd3d14cc04a8fe1bd0319b6 to your computer and use it in GitHub Desktop.
WireGuard Port Forwarding to CGNET Client
## Seed
## xeob8mPP2VPHBXHCexEPGjOMdBKgQ7qCv2tRC6BXSfQ2ahAeEHC374OyOykUYCyRKU/n8Azv6cw6/MLwNZq9HSYEPfKNFTKhJG2vKZUmFNzc9RDzxya9Lp9VsE34P/tWL4EBO+c7an3Lvi9vXYI79uTbVMcdmNQP5ZrQ6AIZYwCc/N1jdM71muV4Vc94jY9aRsmQvC6bOrxgHlAcWrUw8irEbUNCg5xe5INpnCjbRSXnojisx07zmNDSQ5BUH4LXhRok/uIuGg5qqJaans+FegDc1+aN2L2cTlcefYjTJnMNIjzuPFBClbaAszDTcmQ7wjF7TdYZgJTd3V+754+RlQ==
## WireGuard Server Configuration
[Interface]
Address = 172.73.74.1/24
ListenPort = 12345
PrivateKey = wLgZoPI44SU67MXktUnRMNYz4WbLTYIWweX03cBXukQ=
## Allow communication between WireGuard peers and MASQUERADE traffic
PostUp = iptables -A FORWARD -i %i -j ACCEPT; iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE;
PostDown = iptables -D FORWARD -i %i -j ACCEPT; iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE;
## Port Forwarding to WireGuard Outline Client
PostUp = iptables -t nat -A PREROUTING -i eth0 -p tcp -m multiport --dports 23456,34567 -j DNAT --to-destination 172.73.74.2; iptables -t nat -A POSTROUTING -d 172.73.74.2 -j MASQUERADE;
PostDown = iptables -t nat -D PREROUTING -i eth0 -p tcp -m multiport --dports 23456,34567 -j DNAT --to-destination 172.73.74.2; iptables -t nat -D POSTROUTING -d 172.73.74.2 -j MASQUERADE;
## WireGuard Outline Client
[Peer]
PublicKey = 8Ia/YzZdXONOhXnN/ibnE/9LSshXoyQOctum5r7gdi4=
AllowedIPs = 172.73.74.2/32
---------------------------------------------------------------------------------------------------
## Outline Client Configuration
[Interface]
Address = 172.73.74.2/24
ListenPort = 12345
PrivateKey = GOH7AVifDSr5lrJ34EgNkFk0pvKYM8nZAjPFwC/3DF8=
DNS = 1.1.1.1
MTU = 1392
[Peer]
PublicKey = 8rGb5sw4cIfE+VTg5Rp3f7WvCCZl4nqLYysF/gZbhDc=
AllowedIPs = 172.73.74.0/24
Endpoint = YOUR-SERVER-IP:12345
## Add Keepalive Otherwise Port Forwarding will not work on Linux Client
PersistentKeepalive = 25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment