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

    Can I Block Outgoing Traffic to Ports on WAN Interface?

    Scheduled Pinned Locked Moved Firewalling
    8 Posts 4 Posters 5.8k 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.
    • G
      guardian Rebel Alliance
      last edited by

      Is it possible to block outgoing traffic on the WAN interface (possibly with a floating rule)?

      I want to prevent traffic for the following ports 135, 136, 137, 138, 139, 445, 593, 1900, 5000, 5353 ever going out on the intenet.
      (Should I be adding anything to this list for a home setup?)

      If I just had a LAN/WAN, then it would be no problem, just put a rule on the LAN, but I have several VLANS.

      I want to keep things simple, so it would be better to not have to put rules on each VLAN interface.

      Any help would be much appreciated.

      If you find my post useful, please give it a thumbs up!
      pfSense 2.7.2-RELEASE

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

        this would be a good rule to put in floating for outgoing.

        But to be honest - none of that traffic should ever really go out the wan..  Are you seeing this traffic leave now?  Simple sniff on your wan would show you if that is currently the case.  Or could just put in the floating rule and then log it and come back later to see if any hits on the rule.

        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
        • DerelictD
          Derelict LAYER 8 Netgate
          last edited by

          Yeah a floating rule on WAN outbound would be a good place for that.

          Reject quick interface WAN direction out protocol any source address any source-port any dest address any dest port a a port alias containing all of those ports.

          Probably enable logging on the rule too so if it blocks something unintended it will be logged so you can see it.

          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 1
          • G
            guardian Rebel Alliance
            last edited by

            Thanks very much for the replies johnpoz & derelict

            Extra big thanks to derelict for giving me the rule, because I'm still struggling with how floating rules work.

            @johnpoz:

            But to be honest - none of that traffic should ever really go out the wan..  Are you seeing this traffic leave now?  Simple sniff on your wan would show you if that is currently the case.  Or could just put in the floating rule and then log it and come back later to see if any hits on the rule.

            Are there built in firewall rules to prevent this broadcast traffic from leaving the network?  Not sure if they have fixed it, but the cable company network allows a lot of stuff to float around that shouldn't be.

            If you find my post useful, please give it a thumbs up!
            pfSense 2.7.2-RELEASE

            1 Reply Last reply Reply Quote 0
            • DerelictD
              Derelict LAYER 8 Netgate
              last edited by

              Are there built in firewall rules to prevent this broadcast traffic from leaving the network?

              Broadcast traffic would not be routed out WAN.

              You are looking at preventing unicast traffic to those ports out WAN.

              Not sure if they have fixed it, but the cable company network allows a lot of stuff to float around that shouldn't be.

              Your ISP is in the business of routing traffic. It is not necessarily in the business of blocking things you might not want to receive. Someone else might want that traffic for some reason. "Shouldn't be" is subjective. That's why you can run your own firewall tailored to your own specific needs.

              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
              • G
                guardian Rebel Alliance
                last edited by

                UPDATE:
                After a bit of logging I notice that 192.168.x.2:138 does a broadcast to 192.168.x.255:138.  If that gets to create a firewall state, it's game over for any open network shares.  I had it happen once with DD-WRT - fortunately nothing really bad happened, but I was just lucky.

                If you find my post useful, please give it a thumbs up!
                pfSense 2.7.2-RELEASE

                1 Reply Last reply Reply Quote 0
                • K
                  kpa
                  last edited by

                  @guardian:

                  UPDATE:
                  After a bit of logging I notice that 192.168.x.2:138 does a broadcast to 192.168.x.255:138.  If that gets to create a firewall state, it's game over for any open network shares.  I had it happen once with DD-WRT - fortunately nothing really bad happened, but I was just lucky.

                  Sorry but you don't seem to yet understand what a broadcast is and why it can't cross routers. Broadcasts are limited to the immediately connected network segment, you can almost guess this by looking at a broadcast address. A broadcast address 192.168.x.255 means exactly "all the network nodes that are directly reachable on the same network segment (usually connected to the same wire but bridges can change that) that have an address in the 192.168.x.0/24 network".

                  Yes a broadcast can create a state on the LAN interface of pfSense (assuming 192.168.x.* is your LAN but see below) but that's not going to do anything on the WAN interface because broadcasts are not routed across interfaces. The only way to have broadcasts/multicasts routed is to have a proxy on the router do the job and pfSense doesn't include proxies for most of the broadcast/multicast based protocols, the one notable case is the avahi package that can proxy mDNS traffic and you have to install the package first and enable the service.

                  If 192.168.x.* is on your WAN side then I don't understand why you even think the broadcasts could get trough, the default policy is to block unrecognized traffic including broadcasts.

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

                    So did you create the floating rule?  How many hits you seeing ;)  The ports you listed are normally broadcast/multicast ports that would never be sent out your want.. Ie 1900 and 5353.. Those netbios ports you listed.. While its possible that windows being as stupid as it is might do a netbios query to you websites you hit, etc.  That would most likely be on 139..

                    I put a block on 137-139 tcp/udp on my floating outbound on the long while back, in answer to another thread and someone wanting an example.. I never removed it.. So almost 1 million evaluations.. Zero triggers..

                    outbound.png
                    outbound.png_thumb

                    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.