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

    Blocking specific ports outbound to internet but not across interfaces

    Firewalling
    3
    3
    742
    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.
    • J
      jeffhammett
      last edited by

      I have a number of OPT interfaces and VLANs setup on my pfSense.

      I want to block certain ports out to the internet for all interfaces, but want to allow these ports between internal interfaces.

      What is the best way to achieve this?

      I think I could a floating rule with specific ports/protocols set and the Advanced option set for the WAN Gateway and then apply it to the interfaces I want it applied to. Is there a better way?

      If I need to allow exceptions would that be possible with the above setup by individual rules on the specific interface? Or would those need to be a higher priority floating rule that only applies to the exceptions (limited by source, destination, etc.)?

      1 Reply Last reply Reply Quote 0
      • V
        viragomann
        last edited by

        There may be certain ways to reach your goal.

        For instance:
        Add an IP alias for you internal networks if they are not contiguous subnets, lets call it intranet. Add a port alias for the ports you want to block (i.g. blocktoWAN).
        Then add a floating rule:
        Block
        select your internal interfaces
        at destination check "not", select "single host or alias" and enter intranet in the field below
        at destination port range enter blocktoWAN in from and to field

        You will also need a floating pass rule with lower priority to permit other traffic. Rules added to the interfaces tabs are preferred unless you check the Quick option in the floating rule.
        So if you neet exception, you may add it to the interfaces tabs.

        However, I think it's more clearly to add rules to each interface.
        You can quickly achieve this by adding the rule to one interface, then copy it by clicking the "+" beside and change the interface.

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

          I agree with viragomann, its best to place rules on each interface vs floating to be honest.

          A simple block rule to ! rfc1918 alias would stop access to whatever port(s) you wanted to block with no effect on local traffic.  If your really really lazy, you could put that as a floater..  Or in your floater just block the ports you want outbound on your wan interface.

          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
          • First post
            Last post
          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.