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

    Block internet access on some machines belonging to LAN

    Scheduled Pinned Locked Moved Firewalling
    5 Posts 4 Posters 3.5k 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.
    • S
      stathis
      last edited by

      Hello all,

      I have a LAN 192.168.2.0/24 and i want to block the internet access on some machines. I would prefer to keep the same subnet and DHCP server.

      Initially i tried to mark the special machines by MAC address, but as i discovered there is no such thing in pfSense.

      Other idea was to group those special machines on vlan 20 and create a new interface, but unique subnet is a mandatory property of interface.

      Can anybody help me?

      I would appreciate any help.

      1 Reply Last reply Reply Quote 0
      • B
        bhjitsense
        last edited by bhjitsense

        Make a rule on the LAN that blocks traffic from this host's IP (or make an alias that contains those hosts) from going anywhere but the local network (you'll use the negate feature of the destination network option in the rule settings.)

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

          Just put the rule that blocks access for your IPs above the default lan rule of any any.

          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
          • A
            akuma1x
            last edited by akuma1x

            You need to setup static DHCP leases for these machines. You can find that in Services -> DHCP Server, all the way at the bottom. You need to know the MAC Addresses of these computers to put them in a static lease. Their static IP addresses need to be OUTSIDE your DHCP server range.

            After you give them static addresses, you should put them all into an Alias, that's located under the Firewall tab. By adding them all to an Alias, is makes it really easy to add this group to a single firewall rule.

            Next, make an Alias that contains private networks (the ones we all use INSIDE our firewalled networks). That alias should have these 3 networks in it: 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16. You can name this alias whatever you want, but make sure to set the type to Network(s).

            So, then you need to make a single block rule on your LAN interface like this:

            Action: Block
            Interface: LAN
            Address Family: IPv4
            Protocol: Any
            Source: Single host or Alias (pick the alias you made for your computers)
            Destination: Invert Match, Single Host or Alias (pick the alias you made for private internets)

            Give it a good description name and save. Make sure this new firewall rule is above the "allow lan to any rule" in the rule list.

            If you've got a lot of rules on your LAN, you should probably restart the rules, reset the states on the "allow lan to any" rule, or even reboot the firewall. But, that might not be necessary. Give it a try and see what happens.

            So, what all of this does is this: you set your internal machines to have static IP addresses, you put them in an alias, you add all private internets to an alias, then you make a rule that says block all internal machines in this alias to all networks that are NOT private networks. This lets you still get access to internal machines/networks, like servers and such, and should work perfectly for blocking these machines from getting out to the internet. It did for me, after I set it all up and tested.

            Jeff

            1 Reply Last reply Reply Quote 1
            • S
              stathis
              last edited by

              Thank you all, especially @akuma1x for detailed description.

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