OPNsense
  • Home
  • Help
  • Search
  • Login
  • Register

  • OPNsense Forum »
  • Archive »
  • 22.7 Legacy Series »
  • Killing IPv6 communication for a device in LAN
« previous next »
  • Print
Pages: [1] 2

Author Topic: Killing IPv6 communication for a device in LAN  (Read 4498 times)

pawlisko

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
    • View Profile
Killing IPv6 communication for a device in LAN
« on: December 21, 2022, 05:13:16 pm »
Quick question - as I am new to the OPNsense world.

Killing (temporarily) IPv6 communication for a device inside LAN. In MikroTik, I would create rules in FW to drop in/out IPv6 transmission based on the device MAC address (due to the device being SLAAC only), and I can't turn off IPv6 support in the device. Basically if device sniffs IPv6 it will go for IPv6 address and communication.

I tried to replicate it here with partial success. Some transmission is going through thou on intermittent bases.

What is the proper way in OPNsense to kill IPv6 communication for the host?
Logged

bartjsmit

  • Hero Member
  • *****
  • Posts: 2023
  • Karma: 194
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #1 on: December 22, 2022, 09:15:59 am »
OPNsense is based on FreeBSD which doesn't firewall on MAC address. You can assign a separate VLAN on your managed switch to the device and disable IPv6 on that.
Logged

pawlisko

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #2 on: December 28, 2022, 03:19:12 pm »
It sounds like it was easier to code on L3 rather than on L2 and we are stuck with solution witch is way sub-optimal and to workaround that we need to create so much more than it needs.
Your solution is manageable if device is connected through ethernet, but what - change of WLAN or creating additional SSIDs for WiFi for each device does not make sense. What if I have 5 devices like that and I want for 4 to use IPv6 than what? 5 VLANs? 5 WiFi networks? What about ease of use? Not to mention support or troubleshooting.
Logged

RamSense

  • Hero Member
  • *****
  • Posts: 595
  • Karma: 11
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #3 on: December 28, 2022, 06:07:08 pm »
how about getting those devices a static ip(4 and/or 6) and block it on ip, or when several, making an alias with those ips and blocking it. I am using that for my kids devices to block the internet for them to support bedtime :-)
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #4 on: December 28, 2022, 07:09:44 pm »
OPNsense does have MAC addresses as aliases in the firewall section. Can't it set up rules with these as source or destination?
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

RamSense

  • Hero Member
  • *****
  • Posts: 595
  • Karma: 11
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #5 on: December 28, 2022, 07:31:32 pm »
Those MAC addresses as aliases don't seem t work. About a year ago I tried that approach in the captive portal and got an answer back like what @bartjsmit is saying that opnsense/freebsd does not firewall mac addresses.
That is when I set up all devices on the network with static ip, not a known device, no connection, and being able to control the connection of every device.
Would be an awesome feature if the MAC addresses would be included also
Logged

pawlisko

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #6 on: December 28, 2022, 08:46:10 pm »
Quote from: RamSense on December 28, 2022, 06:07:08 pm
how about getting those devices a static ip(4 and/or 6) and block it on ip, or when several, making an alias with those ips and blocking it. I am using that for my kids devices to block the internet for them to support bedtime :-)

IPv4 - I setup it up as static, so it is easy to configure - No issue here

IPv6 - is using SLAAC - hence my original post about sniffing out IPv6 address. So device can use DHCPv6 but because I have some which can't I have to use RA in Assisted mode (Flags M+O+A), and many devices, including the device in question, prefer SLAAC over DHCPv6.

For kids devices I use built in Kids Mode (iOS and Amazon - did that right).
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #7 on: December 28, 2022, 09:48:46 pm »
Quote from: RamSense on December 28, 2022, 07:31:32 pm
Those MAC addresses as aliases don't seem t work. About a year ago I tried that approach in the captive portal and got an answer back like what @bartjsmit is saying that opnsense/freebsd does not firewall mac addresses.
That is when I set up all devices on the network with static ip, not a known device, no connection, and being able to control the connection of every device.
Would be an awesome feature if the MAC addresses would be included also
Oops  :)

I was planning to use exactly these to permit only my laptop and iPad from the family VLAN into the management VLAN. Let's see - I'll report back.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

zan

  • Full Member
  • ***
  • Posts: 175
  • Karma: 31
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #8 on: December 29, 2022, 08:30:43 am »
Out of curiousity I set up a MAC alias for my Android phone and turned on IPv6 support on my Wifi vlan and RA service with Assisted mode.
I could see my phone got a SLAAC address and the MAC alias from OPNSense's Diagnostics->Aliases also resolved to the same address.
Then I setup a block rule for that MAC alias and it seems to be working as expected.
So it looks like OPNSense can firewall by MAC address just fine, what do I miss here?
Logged

pawlisko

  • Newbie
  • *
  • Posts: 19
  • Karma: 0
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #9 on: December 29, 2022, 03:21:51 pm »
Quote from: zan on December 29, 2022, 08:30:43 am
Out of curiousity I set up a MAC alias for my Android phone and turned on IPv6 support on my Wifi vlan and RA service with Assisted mode.
I could see my phone got a SLAAC address and the MAC alias from OPNSense's Diagnostics->Aliases also resolved to the same address.
Then I setup a block rule for that MAC alias and it seems to be working as expected.
So it looks like OPNSense can firewall by MAC address just fine, what do I miss here?

SLAAC IPv6 addresses tend to change. There are devices like i.e. my printer which has one IPv6 address based on MAC address, but iOS devices are taking 2 IPv6 addresses and then start to circulate then taking new address etc, same situation is with Windows. So other people said FBSD is working on L3 (IP level) not on L2 (MAC level). MAC addresses are resolved to IP addresses every 5 minutes. So if your IPv6 changed 1 second after OPNsense refreshed it to block, your device has 4 minutes and 59 seconds when it is not technically blocked as new IPv6 address is not blocked.
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #10 on: December 29, 2022, 07:50:35 pm »
More precisely the pf firewall in FreeBSD according to the documentation only works on layer 3 and layer 4 information. There are three different firewalls in FreeBSD and e.g. ipfw works perfectly well on MAC addresses (layer 2).

Why pfSense and consequently OPNsense picked pf over ipfw I don't know. But that's the state of affairs it seems. During the years I built FreeBSD based routers and VPN gateways from scratch I always used ipfw.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

bartjsmit

  • Hero Member
  • *****
  • Posts: 2023
  • Karma: 194
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #11 on: December 30, 2022, 10:43:01 am »
Most, if not all commercial enterprise grade firewalls don't go below layer 3 either. MAC addresses are too easily spoofed and enforcement of layer 2 security is best done on switches through VLAN separation.

I know you can spoof IP addresses as well, but that's not much good to an attacker if they can't break out of the corresponding VLAN.

Bart...
Logged

lilsense

  • Hero Member
  • *****
  • Posts: 600
  • Karma: 19
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #12 on: December 30, 2022, 01:05:58 pm »
Quote from: pmhausen on December 29, 2022, 07:50:35 pm
More precisely the pf firewall in FreeBSD according to the documentation only works on layer 3 and layer 4 information. There are three different firewalls in FreeBSD and e.g. ipfw works perfectly well on MAC addresses (layer 2).

Why pfSense and consequently OPNsense picked pf over ipfw I don't know. But that's the state of affairs it seems. During the years I built FreeBSD based routers and VPN gateways from scratch I always used ipfw.

I believe the reason is that, today, this problem (MAC block) is solved with dot1x on a switch. OPNsense is for firewalling and DPI/IPS. Although, you can run RADIUS and try to setup dot1x on an OPNsense, but I was unable to achieve it as there are very little documentation for setting up dot1x on OPNsense.
Logged

Patrick M. Hausen

  • Hero Member
  • *****
  • Posts: 6935
  • Karma: 584
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #13 on: December 30, 2022, 01:47:52 pm »
Another alternative is MAC based VLAN assignment via VMPS with FreeRADIUS. I used to run that for a while. Every device not explicitly configured ends up in the guest VLAN. Or a "dead" one, depending on your policy.

Also needs support on the switch side, of course.
Logged
Deciso DEC750
People who think they know everything are a great annoyance to those of us who do. (Isaac Asimov)

lilsense

  • Hero Member
  • *****
  • Posts: 600
  • Karma: 19
    • View Profile
Re: Killing IPv6 communication for a device in LAN
« Reply #14 on: December 30, 2022, 02:45:49 pm »
Nice... :) Cisco only though...
Logged

  • Print
Pages: [1] 2
« previous next »
  • OPNsense Forum »
  • Archive »
  • 22.7 Legacy Series »
  • Killing IPv6 communication for a device in LAN
 

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