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

    How do you direct all traffic from a remote Wireguard peer through my pfsense SG5100

    WireGuard
    wireguard allowed ip
    4
    14
    3.3k
    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.
    • M
      munson
      last edited by

      How do you direct all traffic from a remote Wireguard peer through my pFsense SG5100. With OpenVPN I set my remote clients to direct ALL traffic through my pFsense router, including those to external sites. Now that I have set up Wireguard, all traffic to the pFsense router goes via Wireguard. However traffic to external sites does not. I have added 0.0.0.0 as an allowed IP, still no luck. Any suggestions?

      J 1 Reply Last reply Reply Quote 0
      • J
        Jarhead @munson
        last edited by

        @munson You mean 0.0.0.0/0 as THE allowed IP, right? Should be the only one.

        M 2 Replies Last reply Reply Quote 0
        • M
          munson @Jarhead
          last edited by

          @jarhead Thanks for your reply. On th remote device I have set the allowed IPs to 0.0.0.0/0. while on the SG5100 the allowed IPs are 172.x.y.z (Wireguard interface),192.168.y.z and 192.168.y.z . Should I change the SG55100 allowed IPs to 0.0.0.0 instead?

          Thanks

          G 1 Reply Last reply Reply Quote 0
          • G
            gabacho4 Rebel Alliance @munson
            last edited by

            @munson you need to make sure you have an outbound NAT rule for the WireGuard subnet to exit via WAN interface.

            M 1 Reply Last reply Reply Quote 0
            • M
              munson @Jarhead
              last edited by

              @jarhead Yes for clarification the remote device allowed IP is 0.0.0.0/0, while on the SG5100 I have listed the three networks. I must be doing something wrong.

              1 Reply Last reply Reply Quote 0
              • G
                gabacho4 Rebel Alliance
                last edited by gabacho4

                the allowed IPs is not the same thing as outbound NAT. If the remote device is an router, then 0.0.0.0/0 will enable you to send traffic for any IP address over the wireguard link. Assume you are using policy based rules to do that. On the 5100 end, you need to have allowed IPs set to the remote subnets. Also, you need to make sure you have the IP address of the remote wireguard interface as well. So it would be for example like 10.10.10.2/32. BUT on the the 5100, if the goal is to allow remote devices to access the internet, you need to have an outbound NAT rule allowing the remote subnets to exit via WAN.

                so if my remote subs were 192.168.10.0/24, 192.168.20.0/24, and 192.168.30.0/24, I would need an outbound NAT rule for each one of those subnets as the source with the WAN interface selected as the outbound one

                1 Reply Last reply Reply Quote 0
                • G
                  gabacho4 Rebel Alliance
                  last edited by gabacho4

                  Also, you need to make sure you set static routes on the 5100 so that the router knows where to send traffic to your remote subnets. You'd make a route destined for each subnet, with the wireguard interface as the gateway. If you have not already done so, you should read the Pfsense documentation on Wireguard. It is very clear and they even provide example configs.

                  1 Reply Last reply Reply Quote 0
                  • M
                    munson @gabacho4
                    last edited by

                    @gabacho4

                    Thanks . Can you please provide an example, and what page in pFsense is this added.

                    G 1 Reply Last reply Reply Quote 0
                    • G
                      gabacho4 Rebel Alliance @munson
                      last edited by

                      @munson NAT is on the Firewall tab -> NAT -> Outbound. Then set your NAT to hybrid or manual (which I prefer personally) and add the rules I described.

                      For static routes, you need to go to System -> Routing -> Static Routes and then create the routes as I described them.

                      1 Reply Last reply Reply Quote 0
                      • M
                        munson
                        last edited by

                        Thanks for your patience and expert advice. I just got back to this project. I still can not send all traffic from a peer through my SG51000

                        Here are some screenshots of my rules and configurations, any suggestions would be appreciated:
                        014c460d-e21e-4d74-a7b6-6061360a39cf-image.png

                        dc3f8c04-4e50-4d34-a483-74a5af98492c-image.png

                        8286133b-228d-4689-9004-e2af8e16d1bf-image.png

                        74f92714-d50c-4dc0-821b-577550aafd76-image.png

                        83b1ef2d-e712-4f9f-ab6a-01aa95c873dd-image.png

                        Here is the iphone configuration a1e1a0ba-28c6-4b59-8b33-d65e3449e341-image.png
                        7ec4a70d-889d-44ee-b025-7aeef5c863f8-image.png
                        Any assistance would be appreciated.

                        G 3 Replies Last reply Reply Quote 0
                        • G
                          gabacho4 Rebel Alliance @munson
                          last edited by

                          @munson Your NAT rule is wrong. It's not the wireguard interface you are sending the traffic out to the world but WAN. Your network address (not sure why you blacked that out since they are private IPs and not public ones) should be the subnet that your client phone uses. So if the client IP is 192.168.100.2/32 then the network subject on your NAT outbound should be 192.168.100.0/24. I guess you could make it for just one IP but that seems unnecessary.

                          1 Reply Last reply Reply Quote 0
                          • G
                            gabacho4 Rebel Alliance @munson
                            last edited by gabacho4

                            @munson Also, on the peers setting on the 5100, remove the 0.0.0.0/0 and just put the ip address of your phone. Looks like you're using a 172.16.x.x/24 structure so it should be 172.16.x.x/32 (whatever the specific IP for the phone is).

                            EDIT: sorry that wasn't very clear. On the 5100, the allowed IP address(es) is just the client IP. remove the 0.0.0.0/0.

                            1 Reply Last reply Reply Quote 0
                            • G
                              gabacho4 Rebel Alliance @munson
                              last edited by

                              @munson any update?

                              R 1 Reply Last reply Reply Quote 0
                              • R
                                Ryu945 @gabacho4
                                last edited by

                                @gabacho4 Did you ever figure it out?

                                1 Reply Last reply Reply Quote 0
                                • K kevdog referenced this topic on
                                • First post
                                  Last post
                                Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.