IPTables rules based on mac-address

OK .. lets extended our knowledge of IPTables from what we had learned yesterday. Remember, these tips are not a part of any standard course curriculum like RHCE, RHCSS etc.

Here lets learn how to block a host based on his MAC-ADDRESS. So that he cannot change the IP to try get access. (in case he has changed the nic card also, i should not be contacted)

I am showing you how to use mac address in IPTables to create rules for accept or reject.

iptables -A INPUT -p tcp –destination-port 22 -m mac –mac-source 11:22:33:44:55:66 -j REJECT

Just replace 11:22:33:44:55:66 with the actual mac-address of the host.

Here is a small demo based on this tip for SSH.

Do join Network NUTS Facebook page.

Do like it .. for my photo-editing skills 🙂

Using mac-address to create rules in IPTables

Using mac-address to create rules in IPTables

Advertisements