Search code examples
firewallfreebsdipfw

How to block based on Mac address on FreeBsd? (ipfw firewall)


i have worked on freebsd for a while.I installed ipfw configuration firewall and setup it. I want to filter based on Mac Adress.How can i do?I wrote that but it didn't work.

ipfw add 4 allow ip from any to any layer 2 mac-type arp
ipfw add 5 deny ip from any to any MAC any 1A:BF:48:9F:71:3B in recv $em0
ipfw add 6 deny ip from any to any MAC any 1A:BF:48:9F:71:3B any in recv $em1

Thank you for your answer


Solution

  • ipfw add 4 allow ip from any to any layer 2 mac type-arp
    ipfw add 5 deny ip from any to any MAC any 10:BF:48:9F:74:6C in recv em1
    ipfw add 6 deny ip from any to any MAC 10:BF:48:9F:74:6C any out xmit em0
    ipfw add 7 allow ip from any to any MAC any any