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

    Firewall rule to allow WAN outgoing

    Scheduled Pinned Locked Moved Firewalling
    14 Posts 5 Posters 2.3k 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.
    • Bob.DigB
      Bob.Dig LAYER 8 @silviub
      last edited by

      @silviub If you don't want to block every other VLAN then you have to create an RFC1918-alias for all private IPs and make a blockrule with that. This will at least work for IPv4.

      S 1 Reply Last reply Reply Quote 0
      • S
        silviub @Bob.Dig
        last edited by

        @Bob-Dig that's not what I want.
        I want to allow SEC1 traffic to leave the WAN interface (NATed) but I don't want SEC1 to be able to reach LAN/SEC2.

        Bob.DigB S 2 Replies Last reply Reply Quote 0
        • Bob.DigB
          Bob.Dig LAYER 8 @silviub
          last edited by

          @silviub said in Firewall rule to allow WAN outgoing:

          that's not what I want.

          Read the docs, you seem to have no clue at all how this works...

          S 1 Reply Last reply Reply Quote 0
          • S
            silviub @Bob.Dig
            last edited by

            @Bob-Dig You are right, I have no clue how this works and I have read the docs, but they don't seem to answer my question.
            I've got a simple question: how can I allow one VLAN to access the internet while limiting its access to any other VLANs. I feel like this is really difficult to accomplish using PFSense or I'm missing something (which is probably the case), that's why I opened this thread, to get some help so:
            How would you achieve this, since it looks like you know your way around PFSense? In any other system (even FreeBSD) you can say "Pass from <interface> to <interface>...?

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

              @silviub said in Firewall rule to allow WAN outgoing:

              @Bob-Dig that's not what I want.
              I want to allow SEC1 traffic to leave the WAN interface (NATed) but I don't want SEC1 to be able to reach LAN/SEC2.

              On SEC1:

              • reject from Sec1 Net to LAN
              • reject from SEC1 Net to pfSense port 443/22 (if desired)
              • allow from SEC1 Net to any

              Rules are applied on the interface as packets arrive. โ€œAnyโ€ being all IPs which includes the Internet.

              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
              • johnpozJ
                johnpoz LAYER 8 Global Moderator @silviub
                last edited by

                @silviub said in Firewall rule to allow WAN outgoing:

                another saying "Pass to !LAN_net" but if I'll ever get into having 5 - 10 - 20 networks.....)

                The easiest solution to this - ie you adding more networks and not having to adjust your rules is create the mentioned rfc1918 alias.. Assuming all of your future vlans would be rfc1918 space.

                Here is an example locked down vlan, it really can only go to the internet - other than the couple of things allowed. ping to check connectivity to its gateway (pfsense) and dns and ntp.

                rules.jpg

                The rfc1918 alias contains all the rfc1918 space, with just 3 entries.

                alias.jpg

                So if I added a new vlan, say 172.16.31.0/24 this network would not be able to go to it, now if I created some vlan that was not using rfc1918 space it would be allowed because of the last rule that allows any (internet)..

                The reject to "this firewall" prevents this network from talking to say the pfsense wan IP (which is public IP).. So sure that this network can not get to pfsense web gui or ssh, etc.

                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.8, 24.11

                S 1 Reply Last reply Reply Quote 2
                • S
                  silviub @johnpoz
                  last edited by

                  @SteveITS that wouldn't work because each time I'm adding a new VLAN, I'd have to set the first rule for each VLAN (reject from SEC1 NET to <VLAN>)
                  @johnpoz Thank you! I combined the last two rules saying "Pass from TEST net to !rfc1918". This solves it so thank you!

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

                    @silviub not really a fan of bang rules. Its better to be very explicit in what is allowed or rejected. For one its easier to read as human - this is allowed, this not - vs oh there is a little ! symbol - the opposite is actually allowed, etc.

                    And if you use vips there has been some issues, etc..

                    I would just add the 2 rules, so its very clear to what is allowed and what is not. There is no performance issue if you have 10 rules or 1000..

                    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.8, 24.11

                    1 Reply Last reply Reply Quote 2
                    • P
                      pV5
                      last edited by

                      I had a similar questions and found my answers here. Thank you to all that replied. Following johnpov's example, I also wanted to add acess to the Admin page which I moved from port 80 to port 10443. I added the first line in my firewall rules for this. Is this a good secure way to allow access to the Admin page? I will not add that line to the other VLANS, so only VLAN10 can access the Admin page. Thank you.

                      Screenshot from 2023-07-22 16-38-14.png

                      S johnpozJ 2 Replies Last reply Reply Quote 0
                      • S
                        SteveITS Galactic Empire @pV5
                        last edited by

                        @pV5 yep that will 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
                        • johnpozJ
                          johnpoz LAYER 8 Global Moderator @pV5
                          last edited by

                          @pV5 normally if I was locking down a vlan, I wouldn't allow access to the pfsense gui. But what you allow or block is up to you.

                          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.8, 24.11

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