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

    Blocking URL's in Pfsense firewall for specifi range of IP

    Scheduled Pinned Locked Moved Firewalling
    17 Posts 3 Posters 1.1k 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.
    • stephenw10S
      stephenw10 Netgate Administrator
      last edited by

      Yup, you can't block with rules like that. The alias will be resolved to an IP or set of IPs when the ruleset is generated but that will only be a tiny fraction of the potential IPs used by youtube.

      You can block by ASN but that will impact far more than just youtube. You pretty much need to filter using DNS to get the sort of functionality you're looking for.

      N 1 Reply Last reply Reply Quote 0
      • N
        ngr2001 @stephenw10
        last edited by

        @stephenw10

        Is there any solution leveraging DNS where I can achieve the desired outcome described.

        i.e.

        By default clients receive pfSense IP (10.X.X.X) as their DNS Server, no other filtering or blocking, PF forwards to 1.1.1.1. (Cloudflare). (Current Setup and Working)

        Select clients (KIDS Systems) receive / have their DNS requests sent to 1.1.1.3. (Working Today via DHCP Reservation)

        Net-New-Addon - Same Select "KIDS Systems" are blocked from youtube.com but again has to continue leveraging 1.1.1.3 as their DNS server so that Adult content is effectively blocked. (Solution Not Found Yet)

        Thanks.

        1 Reply Last reply Reply Quote 0
        • stephenw10S
          stephenw10 Netgate Administrator
          last edited by

          You could switch that around so that most systems use 1.1.1.1 directly but kids systems use Unbound in pfSense and are forwarded to 1.1.1.3. Then you can add filtering to unbound for some domains.

          Or you could pass kids systems to an external DNS service that allows adding domains to block.

          N 2 Replies Last reply Reply Quote 0
          • N
            ngr2001 @stephenw10
            last edited by

            @stephenw10

            Not really crazy about that idea, i have DNS over TLS configured and other local hosts id like to be able to address by hostname easily.

            Perhaps there is a plugin solution ??

            1 Reply Last reply Reply Quote 0
            • N
              ngr2001 @stephenw10
              last edited by

              @stephenw10

              I also found the custom view option you were referencing, which I really like. This would be almost perfect if all clients where using the pfsense box for DNS. I don't suppose there is a way to create a view so that certain clients have their requests forwarded to 1.1.1.1 and others to 1.1.1.3 ? Outside of my current method which is via DHCP. If this does not exist, could this be a potential future product enhancement.

              e9998461-c2d0-49a8-b5ec-9d7169f38795-image.png

              1 Reply Last reply Reply Quote 0
              • stephenw10S
                stephenw10 Netgate Administrator
                last edited by

                I haven't tried that but I believe could. You should be able to set any number of parameters for he client view.

                An alternative here might be to also run the DNS forwarder. You have to run it on a different port to avoid a conflict but you can forward requests to that port.

                N 1 Reply Last reply Reply Quote 0
                • N
                  ngr2001 @stephenw10
                  last edited by

                  @stephenw10

                  Is there any documentation of what parameters exist for DNS Resolver and / or would you be able to hook me up with the syntax for the above scenario.

                  Thank you so much.

                  1 Reply Last reply Reply Quote 0
                  • stephenw10S
                    stephenw10 Netgate Administrator
                    last edited by stephenw10

                    I'm not sure what it would be for that off-hand. But you should be able to enter config for anything that the resolver (Unbound) can do so:
                    https://man.freebsd.org/cgi/man.cgi?query=unbound.conf

                    A lot!

                    N 1 Reply Last reply Reply Quote 0
                    • N
                      ngr2001 @stephenw10
                      last edited by ngr2001

                      @stephenw10

                      How does this look, I would like to backup / edit the unbound config via SSH, where does one find that config file.

                      view:
                      name: "client_110"
                      view-first: yes
                      client-subnet: 1.0.0.110/32

                      forward-zone:
                      name: "."
                      forward-addr: 1.1.1.3

                      1 Reply Last reply Reply Quote 0
                      • stephenw10S
                        stephenw10 Netgate Administrator
                        last edited by

                        The unbound conf file is generated automatically from the pfSense config when the service is started and anytime a change is made. Editing the config directly is only useful as a test. But it's in /var/unbound/unbound.conf.

                        N 1 Reply Last reply Reply Quote 0
                        • N
                          ngr2001 @stephenw10
                          last edited by

                          @stephenw10

                          Good to know.

                          How does my syntax above look ?

                          1 Reply Last reply Reply Quote 0
                          • stephenw10S
                            stephenw10 Netgate Administrator
                            last edited by stephenw10

                            Well like I said I've tried to do that so.... I'm not sure. 😉

                            Does it work? I'd expect to see a load of errors when it creates the test config of there's a problem.

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