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

    Multi WAN and Blocking DNS

    Routing and Multi WAN
    3
    10
    793
    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
      mspeed
      last edited by

      Hi,

      I have the following scenario;

      When using WAN1 you can't access the internet but can access a particular host (e.g bbc.co.uk) and when using WAN2 you can access the open internet

      WAN1 - Block DNS requests to outside DNS servers (e.g 8.8.8.8) from LAN, but also allow DNS to one particular host (e.g bbc.co.uk)
      WAN2 - Allow all traffic from LAN

      How would you achieve this with Firewall rules?

      Many Thanks

      V 1 Reply Last reply Reply Quote 0
      • V
        viragomann @mspeed
        last edited by

        @mspeed
        How do you intend to switch between the WANs?
        Should it be an automatic failover in case, primary is down? If so, which is the primary?

        M 1 Reply Last reply Reply Quote 0
        • M
          mspeed @viragomann
          last edited by

          @viragomann WAN1 as the primary, and if WAN1 is unplugged it would auto failover to WAN2 and auto fail back when WAN2 is unplugged

          I have set the Muti WAN as

          17be1241-eadc-4908-ac89-a647a766dae8-image.png

          V 1 Reply Last reply Reply Quote 0
          • V
            viragomann @mspeed
            last edited by

            @mspeed
            So you only want to restrict outbound traffic on WAN1.

            You can do this with floating quick rules.
            Just add the host names or IPs you want to allow to an alias and the allowed ports to a second one.
            Then add a floating pass rule, check Quick, select WAN1 interface, protocol TCP/UDP and set the direction to out.
            Source: LAN net
            destination: your whitelist alias
            dest. port: port alias
            enter a description

            Add another floating rule, but with block action, check Quick, interface WAN1 selected, protocol any, direction out and again select LAN net as source.
            The pass rule should be on the top, followed by the block rule.

            M 1 Reply Last reply Reply Quote 0
            • M
              mspeed @viragomann
              last edited by

              @viragomann Hi,

              Thanks, for the help so far

              So I have set the following under Floating

              572f61e9-f281-4ab1-aa0d-5800d4cd3bb1-image.png

              and this is under LAN rules

              435d992c-8c89-437c-b8d3-12928013a91a-image.png

              When I have the LAN Net to Any (LAN rules) I can access everything in WAN1, when I remove it I can't access anything at all not even 8.8.8.8 (from the floating rules)

              f14cafcd-fa71-4876-ade7-548398d12c2d-image.png

              V 1 Reply Last reply Reply Quote 0
              • V
                viragomann @mspeed
                last edited by

                @mspeed
                I suspect, the LAN net is not seen on the WAN as source. My bad.

                So you will have to make this work by tagging the packets.
                See Marking and Matching

                To be honest, I've never setup such rule.
                But as I understand it, you have to put the pass rule with the aliases on the LAN tab and enter a tag in the advanced options, e.g. wan1.

                In the floating block rule set the source back to any, open the advanced options and check "invert" at Tagged and enter the tag name (wan1).
                So this rule blocks only packets which are not tagged with wan1 then (all you want to allow is tagged).

                The floating pass rule can be removed.

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

                  Can this be done like so, I need to block outside DNS servers on WAN1 but Allow WAN2 to send DNS outside, this is in the DNS Resolver settings?

                  But also allow WAN 1 DNS to allow DNS to one host?

                  d6dd744e-451d-460d-89f5-3fd818b6d01b-image.png

                  S 1 Reply Last reply Reply Quote 0
                  • S
                    SteveITS Galactic Empire @mspeed
                    last edited by SteveITS

                    @mspeed I think you might be looking for this:
                    https://docs.netgate.com/pfsense/en/latest/multiwan/policy-route.html#enforcing-gateway-use

                    re: Unbound network interfaces, that is what Unbound will query on. It's not related to the PCs on LAN.

                    I'm a little unclear of your goal. If you literally want to block DNS, as opposed to blocking connections out over WAN1, there are several steps involved. This page has a PDF to block DNS over HTTP but may help with those rules, and you can also block port 53 (allow LAN Net to LAN IP:53, block to any:53). Blocking DNS doesn't block connections to web sites though, and "bbc.co.uk" is not a DNS server.

                    edit: forgot the guide URL: https://github.com/jpgpi250/piholemanual

                    Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                    When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                    Upvote ๐Ÿ‘ helpful posts!

                    M 1 Reply Last reply Reply Quote 0
                    • M
                      mspeed @SteveITS
                      last edited by

                      @SteveITS

                      Okay let me explain more and swap the WANs around

                      WAN1 - Standard Internet
                      WAN2 - Expensive satellite-based Internet

                      Allow all traffic to work on WAN1 as "normal" when WAN1 is down auto-failover to WAN2 and only allow critical data through, the goal is to reduce the traffic on WAN2 in this example to as little as possible and only allow one application to work to a particular DNS name

                      S 1 Reply Last reply Reply Quote 0
                      • S
                        SteveITS Galactic Empire @mspeed
                        last edited by

                        @mspeed OK, so I'd say that's not a DNS issue. The policy routing doc should explain what you want...that link and further up that page. I would think "bbc.co.uk" has multiple IPs/servers so you will probably have to compile a list of IPs yourself. If you put bbc.co.uk in an alias pfSense will resolve it every 5 minutes but I expect that would resolve to one IP.

                        Pre-2.7.2/23.09: Only install packages for your version, or risk breaking it. Select your branch in System/Update/Update Settings.
                        When upgrading, allow 10-15 minutes to restart, or more depending on packages and device speed.
                        Upvote ๐Ÿ‘ helpful posts!

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