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

    Unable to connect to wireguard

    Scheduled Pinned Locked Moved WireGuard
    11 Posts 3 Posters 1.9k 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.
    • D
      droidus
      last edited by

      I am running wireguard on my pfsense box. pfsense v2.6.0-release. wg (wireguard) v0.1.6_2. I have the following fw rule enabled on wan to allow the traffic through:
      5523a884-ad61-4483-8ef4-5e022e04abe6-image.png
      I am not able to connect from my client, nor can I telnet via 51820 to my IP address. I just get a "connection timed out" error message. From the pfsense dashboard, wg is running.

      P 1 Reply Last reply Reply Quote 0
      • P
        pst @droidus
        last edited by

        @droidus Make sure you have NAT configured as well. Port 51820 needs to be forwarded, something like this

        b84523b8-eaac-4804-980a-fb9d5e511859-image.png

        D Bob.DigB 2 Replies Last reply Reply Quote 0
        • D
          droidus @pst
          last edited by droidus

          @pst Maybe that's what I am missing. I don't have one for wg. What is port 51825? Is something listening there? How do I know which port to put there?

          EDIT:
          Sorry, actually I do. Under the Outbound tab:
          0e24c939-8127-4688-b65d-589e758f5b23-image.png

          4f9e4b5b-aa5b-4e28-9367-6363bdcdfdb3-image.png

          P 1 Reply Last reply Reply Quote 0
          • P
            pst @droidus
            last edited by

            @droidus when I read your original question I assumed you had problems connecting from outside the firewall to your local network (via a phone for example). For this scenario you need a port mapping as I suggested. In my case port 51825 is the listening port for the configured WG tunnel used for incoming / remote access. If you have outgoing WG tunnels you need to use a different port number for the incoming / remote access (WG might already reject any attempt to use the same ports though).

            If you are having problems with outgoing WG tunnels you don't need the port mapping I suggested. But the outgoing mapping should specify your WG interface, not the WAN as your picture shows.

            D 1 Reply Last reply Reply Quote 0
            • D
              droidus @pst
              last edited by

              @pst I followed the following, and it fixed it for me: https://docs.netgate.com/pfsense/en/latest/recipes/wireguard-client.html#firewall-rules.

              P 1 Reply Last reply Reply Quote 0
              • P
                pst @droidus
                last edited by

                @droidus glad you got it sorted out :)

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

                  @pst said in Unable to connect to wireguard:

                  Make sure you have NAT configured as well. Port 51820 needs to be forwarded, something like this

                  Why? This is not needed at all.

                  @droidus Don't use manual outbound NAT, use hybrid instead. For WireGuard alone even automatic will do.

                  P D 2 Replies Last reply Reply Quote 0
                  • P
                    pst @Bob.Dig
                    last edited by

                    @Bob-Dig said in Unable to connect to wireguard:

                    Why? This is not needed at all.

                    No? The port forwarding has been there since I set up WG a long time ago so I haven't really considered its validity. But if I disable the port forwarding I can't browse on the phone, so I think I'll keep it. Glad you can manage without it.

                    1 Reply Last reply Reply Quote 0
                    • D
                      droidus @Bob.Dig
                      last edited by

                      @Bob-Dig Why shouldn't I use Manual? I tried Hybrid and Automatic, and (Internal) sites no longer load for me.

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

                        @droidus said in Unable to connect to wireguard:

                        @Bob-Dig Why shouldn't I use Manual? I tried Hybrid and Automatic, and (Internal) sites no longer load for me.

                        If you know what you are doing, do it. But if something is not working...

                        D 1 Reply Last reply Reply Quote 0
                        • D
                          droidus @Bob.Dig
                          last edited by

                          @Bob-Dig So I reverted to manual (did a restore) since hybrid and automatic were not working, and it is broken now.

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