Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    How to best debug Wireguard

    Scheduled Pinned Locked Moved WireGuard
    7 Posts 3 Posters 650 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • K
      kevdog
      last edited by kevdog

      A little frustrated here. I've been running a road-warrior-configuration for wireguard from a Digital Ocean Droplet to a home pfSense Server running 2.7.2 for a couple of years. Everything just worked until a couple of days ago -- now the DO droplet can not connect:

      [  +0.000053] wireguard: wg1: Sending handshake initiation to peer 3 (99.xx.xx.xxx:51821)
      [  +5.119909] wireguard: wg1: Handshake for peer 3 (99..xx.xx.xxx:51821) did not complete after 5 seconds, retrying (try 2)
      

      Within pfSense I've configured a dynamic endpoint with wireguard listening over port 51821.
      I haven't changed anything from pfsense side which is frustrating.

      I've port scanned the pfsense from the remote computer using nmap:

      # nmap -sU -p 58121 xx.xx.xxx
      Starting Nmap 7.80 ( https://nmap.org ) at 2024-09-07 14:28 CDT
      
      PORT      STATE         SERVICE
      58121/udp open|filtered unknown
      

      I have a firewall rule on pfSense in regards to an open UDP port on WAN passing all traffic through 51821. I've setup logging on this rule.

      I see nothing in the firewall logs when the remote tries to initiate the handshake from within pfsense. I'm really not sure what to try at this endpoint since I'm kind of stuck.

      T Bob.DigB 2 Replies Last reply Reply Quote 0
      • T
        tedquade @kevdog
        last edited by

        @kevdog The ports don't match (51821 versus 58121).
        Ted

        K 1 Reply Last reply Reply Quote 0
        • K
          kevdog @tedquade
          last edited by

          @tedquade said in How to best debug Wireguard:

          Reply

          Hey thanks for catching my error -- however it was an error how I wrote the post -- not the configuration. Here is my updated "post correction":

          # nmap -sU -p 51821 xx.xx.xx.xx
          Starting Nmap 7.80 ( https://nmap.org ) at 2024-09-07 14:47 CDT
          
          PORT      STATE         SERVICE
          51821/udp open|filtered unknown
          
          Bob.DigB 1 Reply Last reply Reply Quote 0
          • Bob.DigB
            Bob.Dig LAYER 8 @kevdog
            last edited by

            @kevdog You can not expect an answer with nmap for a wireguard port.

            K 1 Reply Last reply Reply Quote 0
            • K
              kevdog @Bob.Dig
              last edited by kevdog

              @Bob-Dig Thanks -- I didn't know that in regards to port scanning WG ports. Are there any specific logs within pfSense I could use to see why the handshake isn't being established?

              Looking through the firewall logs (after enabling all logging on port 51821) I see the following:
              Screenshot 2024-09-07 at 2.55.53 PM.png

              Screenshot 2024-09-07 at 2.59.18 PM.png

              1 Reply Last reply Reply Quote 0
              • Bob.DigB
                Bob.Dig LAYER 8 @kevdog
                last edited by

                @kevdog said in How to best debug Wireguard:

                I've been running a road-warrior-configuration for wireguard from a Digital Ocean Droplet to a home pfSense Server running 2.7.2 for a couple of years.

                WireGuard hardly exists a couple of years for pfSense. Any why a road warrior setup?

                There is no sudden problem with pfSense and WireGuard so your best chance might be to post a lot of screenshots what you did within pfSense. I don't know about Digital Ocean Droplet.

                K 1 Reply Last reply Reply Quote 0
                • K
                  kevdog @Bob.Dig
                  last edited by kevdog

                  @Bob-Dig

                  Hey thanks for chiming in just really stumped why things exactly 2 days ago stopped working.

                  Hopefully this might help from the pfsense side:

                  Wireguard Tunnels:

                  Screenshot 2024-09-07 at 3.11.40 PM.png

                  wg1 interface settings:

                  Screenshot 2024-09-07 at 3.13.45 PM.png

                  Firewall for the WG interface (wg1)
                  Screenshot 2024-09-07 at 3.14.56 PM.png

                  Digital_Ocean_WG_S2S_VPN has value of 10.8.110.0/24

                  Screenshot 2024-09-07 at 3.33.04 PM.png

                  Isn't there a log file somewhere where the WG service would log attempted connections? It seems based on firewall rules and firewall logs there would be traffick passed through to the listening process on 51821. Within the linux client on digital ocean its possible to do dynamic kernel logging. I think within pfSense the wireguard stuff isn't within the kernel but a user space utility?

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post
                  Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.