# Mac OSX \`pfctl\` rule for Cyphal/UDP

**URL:** <https://forum.opencyphal.org/t/mac-osx-pfctl-rule-for-cyphal-udp/1908>\
**Category:** Applications & Usage\
**Created:** [June 11, 2023, 2:47am UTC](https://forum.opencyphal.org/t/mac-osx-pfctl-rule-for-cyphal-udp/1908 "2023-06-11T02:47:03Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![erik.rainey](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/erik.rainey/32/20_2.png) [@erik.rainey](https://forum.opencyphal.org/u/erik.rainey)\
**Post date:** [June 11, 2023, 2:47am UTC](https://forum.opencyphal.org/t/mac-osx-pfctl-rule-for-cyphal-udp/1908/1 "2023-06-11T02:47:03Z")

</div>

If you have the pfctl running on Mac OSX (like in a corporate environment), you’ll need to add some rules to get pfctl to allow all multicast traffic. Chat GPT helped in ironing out some details but missed some important items.

You’ll need to be `sudo` to do this. It requires a few layers of indirection but it’s not too hard.  
This link was most helpful: [firewall - pfctl - howto add an anchor and make it active / load it - Ask Different](https://apple.stackexchange.com/questions/312400/pfctl-howto-add-an-anchor-and-make-it-active-load-it)

First add an anchor to the bottom of the `/etc/pf.conf` file

```auto
# at the end add a user pass filter for Cyphal/UDP
anchor "org.cyphal/*"
load anchor "org.cyphal" from "/etc/pf.anchors/org.cyphal"

```

I left an extra newline.  
In `/etc/pf.anchors/org.cyphal` i added this:

```auto
anchor "org.cyphal"
load anchor "org.cyphal" from "/etc/pf.rules/cyphal-udp.rule"

```

Then in `/etc/pf.rules/cyphal-udp.rule`

```auto
rdr pass on en8 proto udp from any to 239.0.0.0/8 port 9382 -> 0.0.0.0 port 9382
pass in on en8 proto udp from any to 239.0.0.0/8 port 9382

```

This allow receiving multicast on the _en8_ interface (which is just one of MY interfaces, you’ll have to put yours in there!).

Then you’ll have to give it a restart

```auto
sudo pfctl -d
sudo pfctl -e -f /etc/pf.conf

```

---

<div class="post-metadata">

**Author:** ![erik.rainey](https://forum.opencyphal.org/user_avatar/forum.opencyphal.org/erik.rainey/32/20_2.png) [@erik.rainey](https://forum.opencyphal.org/u/erik.rainey)\
**Post date:** [June 11, 2023, 2:49am UTC](https://forum.opencyphal.org/t/mac-osx-pfctl-rule-for-cyphal-udp/1908/2 "2023-06-11T02:49:21Z")

</div>

This also had some helpful debugging information but is a bit dated, so I don’t know if everything is still the same → [PF on Mac OS X – Thus Spake Manjusri](https://manjusri.ucsc.edu/2015/03/10/PF-on-Mac-OS-X/)
