OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 22.1 Legacy Series »
  • Firewall filter - allow inbound access by MAC address
« previous next »
  • Print
Pages: [1]

Author Topic: Firewall filter - allow inbound access by MAC address  (Read 8586 times)

SomebodySysop

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
    • View Profile
Firewall filter - allow inbound access by MAC address
« on: February 12, 2022, 09:41:21 pm »
I have to open a WAN port in my firewall to allow access to VPN.  I have only 3 devices I will ever use to access my VPN server (running on Synology) away from home. 

I was wondering if there was a way to construct a rule in OPNsense which would only allow the MAC addresses of those 3 devices to pass through the WAN at that port?

I have read that, in general, opnsense (and pfsense) do not allow for external MAC filtering because their Linux kernels don't support it.  However, I have also seen mention of something called "captive portal" which might be able to do it.  And, I just saw this article on using pi-hole to see the MAC and IP addresses of external servers: https://pi-hole.net/blog/2021/09/30/pi-hole-and-opnsense/#page-content.

So, thought I'd pose the question here in case someone has done it or knows how to do it.
Logged

ajm

  • Jr. Member
  • **
  • Posts: 62
  • Karma: 7
    • View Profile
Re: Firewall filter - allow inbound access by MAC address
« Reply #1 on: February 12, 2022, 09:53:21 pm »
https://en.wikipedia.org/wiki/MAC_address
Logged

SomebodySysop

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
    • View Profile
Re: Firewall filter - allow inbound access by MAC address
« Reply #2 on: February 12, 2022, 10:01:07 pm »
Quote from: ajm on February 12, 2022, 09:53:21 pm
https://en.wikipedia.org/wiki/MAC_address

So, can I filter by MAC using firewall rules in OPNsense?
Logged

senser

  • Jr. Member
  • **
  • Posts: 55
  • Karma: 0
    • View Profile
Re: Firewall filter - allow inbound access by MAC address
« Reply #3 on: February 12, 2022, 10:54:57 pm »
No, MAC addresses work on layer 2 (hop to hop) and the filter of opnsense works on layer 3 (end to end) and 4 (transport).
https://www.practicalnetworking.net/series/packet-traveling/packet-traveling/
« Last Edit: February 13, 2022, 01:09:50 am by senser »
Logged

lilsense

  • Hero Member
  • *****
  • Posts: 600
  • Karma: 19
    • View Profile
Re: Firewall filter - allow inbound access by MAC address
« Reply #4 on: February 13, 2022, 05:03:40 am »
if FreeBSD you can use ipfw to block MAC addresses for layer 2.

on a PF, however, you would need to create a bridge, then you can filter MAC on the bridge.


Just to be clear, you need no rule for outbound traffic to the WAN side.
Logged

SomebodySysop

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
    • View Profile
Re: Firewall filter - allow inbound access by MAC address
« Reply #5 on: February 13, 2022, 05:29:41 am »
OK, then, can I filter by MAC on the LAN side?  That is, once a device is allowed through the WAN side of firewall, can I capture it's MAC on the LAN side to determine if it is allowed to proceed to the port of the internal host?

And if so, how?
Logged

lilsense

  • Hero Member
  • *****
  • Posts: 600
  • Karma: 19
    • View Profile
Re: Firewall filter - allow inbound access by MAC address
« Reply #6 on: February 13, 2022, 06:14:03 am »
Instead of relying on MAC I would recommend locking down the VPN since there are only going to be 3 devices by using ultra long paswords, etc.

you can place your VPN in a VPN zone and create a specific rule based on the IP to access the devices.
Logged

SomebodySysop

  • Newbie
  • *
  • Posts: 20
  • Karma: 0
    • View Profile
Re: Firewall filter - allow inbound access by MAC address
« Reply #7 on: February 13, 2022, 10:06:23 am »
Quote from: lilsense on February 13, 2022, 06:14:03 am
Instead of relying on MAC I would recommend locking down the VPN since there are only going to be 3 devices by using ultra long paswords, etc.

you can place your VPN in a VPN zone and create a specific rule based on the IP to access the devices.

Got it!  Thanks. 
Logged

zbig

  • Newbie
  • *
  • Posts: 14
  • Karma: 3
    • View Profile
Re: Firewall filter - allow inbound access by MAC address
« Reply #8 on: February 13, 2022, 11:33:10 am »
I have done it using aliases. Defined an alias of type “MAC Address” under “Firewall / Aliases” and referred to it in my firewall rule as a source. Not sure how it works exactly under the hood. I believe it just resolves the MAC to IP when the time to reload aliases comes and uses that IP in the packet filter from now on so it might not be accurate/secure enough in some cases?
Logged

  • Print
Pages: [1]
« previous next »
  • OPNsense Forum »
  • Archive »
  • 22.1 Legacy Series »
  • Firewall filter - allow inbound access by MAC address
 

OPNsense is an OSS project © Deciso B.V. 2015 - 2024 All rights reserved
  • SMF 2.0.19 | SMF © 2021, Simple Machines
    Privacy Policy
    | XHTML | RSS | WAP2