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

    How to deny all except a particular country using pfblockerNG 3.2.0.6 in pfsense 2.7.0?

    General pfSense Questions
    5
    6
    363
    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
      mauro.tridici
      last edited by

      Dear Users,

      I would like to block all inbound traffic from all world countries except for a particular one.

      How can I do it in pfsense 2.7.0 using pfblockerNG 3.2.0.6 without having to block each countries in the Firewall/pfBlockerNG/IP/GeoIP management page?

      Thank you in advance.
      Mauro

      T S 2 Replies Last reply Reply Quote 0
      • T
        The Party of Hell No @mauro.tridici
        last edited by The Party of Hell No

        @mauro-tridici
        From the GEO IP page of pfBlockerNG:

        pfSense by default implicitly blocks all unsolicited inbound traffic to the WAN interface.
        Therefore adding GeoIP based firewall rules to the WAN will not provide any benefit, unless there are open WAN ports.

        I myself block outbound traffic by blocking my LAN segments and OpenVPN Server and Wireguard Server.

        1 Reply Last reply Reply Quote 0
        • S
          SteveITS Galactic Empire @mauro.tridici
          last edited by

          @mauro-tridici You’re two pfSense versions behind.
          https://docs.netgate.com/pfsense/en/latest/releases/2-7-1.html#troubleshooting

          Answer: don’t, allow only the desired country. Create an IPv4 tab alias using “GeoIP” and it will autocomplete the country code. Of course set up MaxMind first…and you may need to run a pfB update for the autocomplete to work.

          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
          • stephenw10S
            stephenw10 Netgate Administrator
            last edited by

            Yup that's the most important thing to realise here: allow the traffic you want; block everything else by default.

            Some users make the mistake of adding block rules for all other countries and that creates a huge number of rules using a lot of resources.

            1 Reply Last reply Reply Quote 0
            • M
              mauro.tridici
              last edited by

              Hello everyone,

              many thanks for your replies.
              I just updated pfSense to the latest available stable version 2.7.2.
              pfBlockerNG is up to date now (v.3.2.0.8), but it is not clear to me how to create the alias you mentioned and how to use it.

              Could you please help me to complete this task?

              Thanks again,
              Mauro

              johnpozJ 1 Reply Last reply Reply Quote 0
              • johnpozJ
                johnpoz LAYER 8 Global Moderator @mauro.tridici
                last edited by johnpoz

                @mauro-tridici create an alias with your country or countries you want to allow, and or any other IPs

                allow.jpg

                This is the alias that is allowed to talk to my plex server. See I allow US Ips, also Morocco because I have a family member currently living there. Then some other IPs that are used to check if my plex server is up and if not warn me.

                The reason for the other lists is because some of those IPs are not always from the US.. Many monitoring services use IPs from all over the planet to make sure your service is up.

                That one labeled PlexRemoteCheck is list plex puts out for their IPs that validate your server is available remote - and it can be IPs outside the US as well.

                An intelligent man is sometimes forced to be drunk to spend time with his fools
                If you get confused: Listen to the Music Play
                Please don't Chat/PM me for help, unless mod related
                SG-4860 24.11 | Lab VMs 2.7.2, 24.11

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