Blocking specific MAC address from contacting me

5,994

You can drop from a source MAC address, yeah:

sudo iptables -A INPUT -m mac --mac-source 00:00:00:00:00:AA -j DROP

Obviously, you'll need to change that address.

If you want to make that permanent, make sure ufw is installed and then edit /etc/ufw/before.rules to have something like this before the COMMIT:

-A ufw-before-input -m mac --mac-source 00:00:00:00:00:AA -j DROP
Share:
5,994

Related videos on Youtube

Maythux
Author by

Maythux

Love To Learn Love To Share

Updated on September 18, 2022

Comments

  • Maythux
    Maythux over 1 year

    Could I block a specific MAC address on my LAN from contacting me?

    I know I could do it from router or switch.

    But I wanna learn if it is possible in Ubuntu(Linux) commands.

    • Rinzwind
      Rinzwind over 10 years
      Check your router manual.
    • Maythux
      Maythux over 10 years
      I want to do it in Ubuntu. Is it possible?
    • Eero Aaltonen
      Eero Aaltonen over 10 years
      The mac tag is about Macintosh computers...
    • Eero Aaltonen
      Eero Aaltonen over 10 years
      The tag is about Macintosh computers, see taginfo
    • Maythux
      Maythux over 10 years
      @EeroAaltonen Ok i got you
  • tanius
    tanius about 6 years
    And if your machine has other iptables rules set up (e.g. configured as a router), then to function, the DROP rule has to be before them in the list, to take precedence. Then use -I INPUT ("insert at pos 1"), not -A INPUT ("append").