Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
Check your router manual. – Rinzwind Jan 24 '14 at 11:09
I want to do it in Ubuntu. Is it possible? – Maythux Jan 24 '14 at 11:10
The mac tag is about Macintosh computers... – Eero Aaltonen Jan 24 '14 at 11:52
The tag is about Macintosh computers, see taginfo – Eero Aaltonen Jan 27 '14 at 11:44
@EeroAaltonen Ok i got you – Maythux Jan 27 '14 at 11:51
up vote 3 down vote accepted

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|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.