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

    Using pfblockerNG for blocking facebook and google

    Scheduled Pinned Locked Moved pfBlockerNG
    16 Posts 4 Posters 17.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.
    • BBcan177B
      BBcan177 Moderator
      last edited by

      To block DNS resolution to those domains, you can add them to a DNSBL Customlist. If you don't use TLD, then you will need to add all of the subdomains that you want to block… ie: (example.com, www.example.com, www.sub.example.com, sub.example.com )

      To block via IP, you will need to find the ASN number and add that to the IPv4/6 Tabs using the "Whois" Source option.

      "Experience is something you don't get until just after you need it."

      Website: http://pfBlockerNG.com
      Twitter: @BBcan177  #pfBlockerNG
      Reddit: https://www.reddit.com/r/pfBlockerNG/new/

      1 Reply Last reply Reply Quote 0
      • S
        security_paranoid
        last edited by

        @BBcan177:

        To block DNS resolution to those domains, you can add them to a DNSBL Customlist. If you don't use TLD, then you will need to add all of the subdomains that you want to block… ie: (example.com, www.example.com, www.sub.example.com, sub.example.com )

        To block via IP, you will need to find the ASN number and add that to the IPv4/6 Tabs using the "Whois" Source option.

        Where is the DNSBL customlist ? Please give me a screenshot.

        1 Reply Last reply Reply Quote 0
        • BBcan177B
          BBcan177 Moderator
          last edited by

          DNSBL FEEDS > Add a new Group ( or use an exising Group) > Scroll to bottom of page and click the "+" to open the DNSBL Custom List.  Click on the Blue InfoBlock Icons for help text.

          "Experience is something you don't get until just after you need it."

          Website: http://pfBlockerNG.com
          Twitter: @BBcan177  #pfBlockerNG
          Reddit: https://www.reddit.com/r/pfBlockerNG/new/

          1 Reply Last reply Reply Quote 0
          • S
            security_paranoid
            last edited by

            @BBcan177:

            DNSBL FEEDS > Add a new Group ( or use an exising Group) > Scroll to bottom of page and click the "+" to open the DNSBL Custom List.  Click on the Blue InfoBlock Icons for help text.

            Thanks a lot for your reply.
            I have added a rule to block Google but its not working. I can still open Google. Please see attachment

            DNSBL.png
            DNSBL.png_thumb

            1 Reply Last reply Reply Quote 0
            • T
              teh g
              last edited by

              You need to add all the variants that Google uses; google.com, www.google.com, subdomain.google.com. etc

              1 Reply Last reply Reply Quote 0
              • S
                security_paranoid
                last edited by

                @teh:

                You need to add all the variants that Google uses; google.com, www.google.com, subdomain.google.com. etc

                I added

                www.google.com
                www.google.co.in
                www.facebook.com
                m.facebook.com
                

                but still I can open Google and Facebook.

                1 Reply Last reply Reply Quote 0
                • BBcan177B
                  BBcan177 Moderator
                  last edited by

                  Enable the TLD option and run a Force Reload DNSBL which will block all sub-domains.

                  "Experience is something you don't get until just after you need it."

                  Website: http://pfBlockerNG.com
                  Twitter: @BBcan177  #pfBlockerNG
                  Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                  1 Reply Last reply Reply Quote 0
                  • S
                    security_paranoid
                    last edited by

                    @BBcan177:

                    Enable the TLD option and run a Force Reload DNSBL which will block all sub-domains.

                    Done. Still not blocking. Please see attachment.

                    tld.png
                    tld.png_thumb
                    dnsbl.png
                    dnsbl.png_thumb

                    1 Reply Last reply Reply Quote 0
                    • BBcan177B
                      BBcan177 Moderator
                      last edited by

                      Just enter

                      google.com
                      facebook.com
                      

                      Then TLD will block all sub-domains… When you enter a sub-domain like "www.facebook.com", it will only block that domain and not any other sub-domain.

                      Will need a Force Reload -DNSBL for the changes to take effect (Plus a clear of your browser cache)

                      "Experience is something you don't get until just after you need it."

                      Website: http://pfBlockerNG.com
                      Twitter: @BBcan177  #pfBlockerNG
                      Reddit: https://www.reddit.com/r/pfBlockerNG/new/

                      1 Reply Last reply Reply Quote 0
                      • S
                        security_paranoid
                        last edited by

                        @BBcan177:

                        Just enter

                        google.com
                        facebook.com
                        

                        Then TLD will block all sub-domains… When you enter a sub-domain like "www.facebook.com", it will only block that domain and not any other sub-domain.

                        Will need a Force Reload -DNSBL for the changes to take effect (Plus a clear of your browser cache)

                        Done. Its working. Thanks a lot.

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

                          It looks like you got there but it depends on what you want to block…  I did a bit of an experiment to block google, really to test their claim that you could choose not to use their services more than anything and the big problem you will have is that you just don't know what sites (that aren't google) rely on their services.  The short version is that you can't, or to do so would be a huge undertaking, certainly beyond a simple block.

                          If you really want to block them you can block their IP range and their dns servers but even I who makes a conscious effort to avoid them, couldn't actually get anything done.  The amount of data that they can mine just from googleapis.com and googlefonts.com for example must be astronomical even if you block the search, ads, and analytics domains.

                          1 Reply Last reply Reply Quote 0
                          • S
                            security_paranoid
                            last edited by

                            @motific:

                            It looks like you got there but it depends on what you want to block…  I did a bit of an experiment to block google, really to test their claim that you could choose not to use their services more than anything and the big problem you will have is that you just don't know what sites (that aren't google) rely on their services.  The short version is that you can't, or to do so would be a huge undertaking, certainly beyond a simple block.

                            If you really want to block them you can block their IP range and their dns servers but even I who makes a conscious effort to avoid them, couldn't actually get anything done.  The amount of data that they can mine just from googleapis.com and googlefonts.com for example must be astronomical even if you block the search, ads, and analytics domains.

                            Despite blocking facebook I sill find the Linux's firewall (ufw) blocking 31.13.70.7 which is xx-fbcdn-shv-01-lax3.fbcdn.net. http://31.13.70.7.ipaddress.com/.

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

                              I sill find the Linux's firewall (ufw) blocking 31.13.70.7

                              Linux has nothing to do with pfSense (and if it did I would stop using it immediately).  What are you trying to achieve and what is (and is not) working?

                              1 Reply Last reply Reply Quote 0
                              • S
                                security_paranoid
                                last edited by

                                @motific:

                                I sill find the Linux's firewall (ufw) blocking 31.13.70.7

                                Linux has nothing to do with pfSense (and if it did I would stop using it immediately).  What are you trying to achieve and what is (and is not) working?

                                Read  this thread and you will understand. https://forum.pfsense.org/index.php?topic=129740.0

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

                                  If I read the thread so far correctly, you are in a position that you have added DNS blackholes for facebook.com and google.com, but are unhappy that the domain fbcdn.net and traffic to facebook's IP space are not blocked when you expected them to be.

                                  The behaviour you're seeing is correct for the configuration you have so far, if you want other domains blocked (like fbcdn.net) then you need to block them in your list as you have done for the other domains.  Many other domains for both facebook and google will also not be blocked (for example youtube.com even though it is part of google).

                                  Even when you block the DNS request pfSense will not stop traffic going to IP addresses directly (for example pinging 31.13.70.7 would still work).  To block traffic entirely you would need to add their domain/AS numbers to IP4 & IP6 lists (Google are AS15169 and facebook are AS32934) and tick the 'domain/AS' box.  I can't remember if you need to include AS prefix as part of the number or not, I'm sure someone will be able to confirm that for you.

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