you're reading...
linux security, linux server

Firewall with iptables using mac address filtering in linux !

https://i0.wp.com/www.liberiangeek.net/wp-content/uploads/2009/08/Comodo_Firewall_Pro_logo.pngThere are times when you might need to filter the traffic on your firewall using MAC addresses instead of IP addresses, iptables has the option to do it.

From the man page of iptables:

Note that this only makes sense for packets coming from an Ethernet device and entering the PREROUTING, FORWARD or INPUT chains.

You may want to insert this line in you firewall script.

iptables -A INPUT -m mac --mac-source 00:11:2f:8f:f8:f8 -j DROP

This way the packets comming from the network element with the MAC address 00:11:2f:8f:f8:f8 will be denied.

That is if you want to block the incoming packets to the firewall, but the blocked machine may still be able to send packets across the firewall, so to block those packets, you may want to add also this line.

iptables -A FORWARD -m mac --mac-source 00:11:2f:8f:f8:f8 -j DROP

About abdessemed mohamed amine



2 thoughts on “Firewall with iptables using mac address filtering in linux !

  1. Hello
    One question? if instead of blocking the mac address I would like to assign 100 k bps to this mac address? how would be the this configuration?

    And where I have to put this line into my ubuntu server 9.10 in order it take effect.


    Posted by Roberto | January 27, 2010, 05:47
  2. And if I want to assign bandwith by Mac Address what could be the way to do it?

    Posted by Roberto_Dominicano | January 27, 2010, 21:11

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: