Skip to content

Instantly share code, notes, and snippets.

@lanceliao
Last active January 29, 2026 21:28
Show Gist options
  • Select an option

  • Save lanceliao/5d2977f417f34dda0e3d63ac7e217fd6 to your computer and use it in GitHub Desktop.

Select an option

Save lanceliao/5d2977f417f34dda0e3d63ac7e217fd6 to your computer and use it in GitHub Desktop.

Revisions

  1. lanceliao revised this gist Aug 2, 2018. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion wg-client1.conf
    Original file line number Diff line number Diff line change
    @@ -4,7 +4,7 @@ PrivateKey = [Client's private key]
    DNS = 8.8.8.8

    [Peer]
    PublicKey = [Server's private key]
    PublicKey = [Server's public key]
    PresharedKey = [Pre-shared key, same for server and client]
    Endpoint = [Server Addr:Server Port]
    AllowedIPs = 0.0.0.0/0
  2. lanceliao created this gist Aug 2, 2018.
    11 changes: 11 additions & 0 deletions wg-client1.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    [Interface]
    Address = 10.200.200.3/32
    PrivateKey = [Client's private key]
    DNS = 8.8.8.8

    [Peer]
    PublicKey = [Server's private key]
    PresharedKey = [Pre-shared key, same for server and client]
    Endpoint = [Server Addr:Server Port]
    AllowedIPs = 0.0.0.0/0
    PersistentKeepalive = 21
    19 changes: 19 additions & 0 deletions wg-server.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    [Interface]
    Address = 10.200.200.1/24
    #SaveConfig = true
    PostUp = iptables -I FORWARD 1 -i wg0 -j ACCEPT; iptables -I FORWARD 1 -o wg0 -j ACCEPT; iptables -t nat -I POSTROUTING 1 -s 10.200.200.0/24 -o eth0 -j MASQUERADE
    PostDown = iptables -D FORWARD -i wg0 -j ACCEPT; iptables -D FORWARD -o wg0 -j ACCEPT; iptables -t nat -D POSTROUTING -s 10.200.200.0/24 -o eth0 -j MASQUERADE
    ListenPort = 10086
    PrivateKey = [Server's private key]

    [Peer]
    # Client 1
    PublicKey = [Client's public key]
    AllowedIPs = 10.200.200.2/32
    PresharedKey = [Pre-shared key, same for server and client]

    [Peer]
    # Client 2
    PublicKey = [Client's public key]
    AllowedIPs = 10.200.200.2/32
    PresharedKey = [Pre-shared key, same for server and client]