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

Port Forwarding - Allow only certain IP ranges.

Scheduled Pinned Locked Moved NAT
5 Posts 3 Posters 3.2k 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.
  • C
    Carreswag
    last edited by Jan 4, 2017, 4:54 PM

    I have a web server port forwarded to port 80 in pfsense, and I want to allow ONLY CloudFlare IP ranges to be able to access my web server at port 80. Is it possible to add multiple networks to the "Source" section when port forwarding? I need to whitelist the following IP addresses: https://www.cloudflare.com/ips/

    The goal is that if a user tries to connect to my web server directly via port 80, they are blocked/cannot access the web server, but I wish to have Cloudflare to be able to access it.

    Thanks

    1 Reply Last reply Reply Quote 0
    • J
      johnpoz LAYER 8 Global Moderator
      last edited by Jan 4, 2017, 4:57 PM

      Create an alias, put those net blocks into the alias, use the alias as your source on your portforward.

      You could prob get fancy and use the https://www.cloudflare.com/ips-v4 in some way.  I believe the pfblocker package allows you to create aliases from urls.

      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 0
      • C
        Carreswag
        last edited by Jan 4, 2017, 6:39 PM

        Oh I see, thanks :)

        1 Reply Last reply Reply Quote 0
        • D
          Derelict LAYER 8 Netgate
          last edited by Jan 5, 2017, 8:28 AM

          You don't need pfBlocker for that.

          IF you want to trust that URL as the source of a list of networks in a pfSense alias, just make a Firewall > Aliases, URL alias like this:

          ![Screen Shot 2017-01-05 at 12.27.44 AM.png](/public/imported_attachments/1/Screen Shot 2017-01-05 at 12.27.44 AM.png)
          ![Screen Shot 2017-01-05 at 12.27.44 AM.png_thumb](/public/imported_attachments/1/Screen Shot 2017-01-05 at 12.27.44 AM.png_thumb)

          Chattanooga, Tennessee, USA
          A comprehensive network diagram is worth 10,000 words and 15 conference calls.
          DO NOT set a source address/port in a port forward or firewall rule unless you KNOW you need it!
          Do Not Chat For Help! NO_WAN_EGRESS(TM)

          1 Reply Last reply Reply Quote 0
          • J
            johnpoz LAYER 8 Global Moderator
            last edited by Jan 5, 2017, 1:19 PM Jan 5, 2017, 1:03 PM

            Yeah my bad in not pointing out the built in way ;)  I had pfblocker on my mind from some other thread.. hehehe

            Derelict is pointing to the better way that is for, no offense to bcan but the pfblocker package has gotten a bit bloated ;)

            I need to fire up pfblocker again though.. Do some playing with latest version.. one thing that curious is pfblocker can use HUGE sets for aliases… But the built in alias says to use small sets..

            Use only with small sets of IP addresses (less than 3000).

            the US listing from IPdeny has almost 50,000 rows of cidr blocks..
            http://www.ipdeny.com/ipblocks/data/countries/us.zone

            Can that be used with the built in aliases or will that cause a problem?  pretty sure pblocker is another interface into the aliases.. So either he breaking suggestions from pfsense for the size of these aliases or the text should prob be updated to the actual value that can be used..

            There is the table IPs url and this allows for 30K listings, but you can only use 1 url?

            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 0
            2 out of 5
            • First post
              2/5
              Last post
            Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.
              This community forum collects and processes your personal information.
              consent.not_received