Skip to content

Instantly share code, notes, and snippets.

@soediro
Created August 25, 2021 12:54
Show Gist options
  • Select an option

  • Save soediro/99d2b2d4c166c7d9e1a1046ba4ef8f4d to your computer and use it in GitHub Desktop.

Select an option

Save soediro/99d2b2d4c166c7d9e1a1046ba4ef8f4d to your computer and use it in GitHub Desktop.

Revisions

  1. @apearson apearson revised this gist Dec 11, 2019. 1 changed file with 9 additions and 0 deletions.
    9 changes: 9 additions & 0 deletions client.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    [Interface]
    PrivateKey = ***********************
    Address = 192.168.10.2/32, fc::2/128
    DNS = 1.1.1.1, 2606:4700:4700::1111

    [Peer]
    PublicKey = ***********************
    AllowedIPs = 0.0.0.0/0, ::/0
    Endpoint = endpoint.domain.tld:51820
  2. @apearson apearson created this gist Dec 11, 2019.
    21 changes: 21 additions & 0 deletions pf.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,21 @@
    # Interfaces
    ext_if = "eth0"
    wireguard_if = "wg0"

    # Wireguard Settings
    wireguard_net_v4 = "192.168.10.0/24"
    wireguard_net_v6 = "fc::0/64"

    # Rules must be in order: options, normalization, queueing, translation, filtering

    # Options
    set skip on lo

    # Translation
    # Nat all wireguard to non-wireguard traffic
    nat on $ext_if inet from $wireguard_net_v4 to { any, !$wireguard_net_v4 } -> ($ext_if)
    nat on $ext_if inet6 from $wireguard_net_v6 to { any, !$wireguard_net_v6 } -> {$ext_if}

    # Filtering
    pass inet all
    pass inet6 all
    9 changes: 9 additions & 0 deletions rc.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    # Wireguard
    wireguard_enable="YES"
    wireguard_interfaces="wg0"

    # Networking
    pf_enable="YES"
    pflog_enable="YES"
    gateway_enable="YES"
    ipv6_gateway_enable="YES"
    9 changes: 9 additions & 0 deletions wg0.conf
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,9 @@
    [Interface]
    PrivateKey = ***********************
    Address = 192.168.10.1/24, fc::1/64
    ListenPort = 51820

    [Peer]
    # Name = Client
    PublicKey = ***********************
    AllowedIPs = 192.168.10.2/32, fc::2/128