Jun
12
Filtering mac address using IPTables in Linux
June 12, 2007 |
A mac address is acronym for media access control address, is a unique address assigned to almost all-networking hardware such as Ethernet cards, router etc
If you want to filter packets on the basis of mac address, it is possible on linux with iptables.
Iptables comes with MAC module. this matches packets traveling through the firewall based on their MAC (Ethernet hardware) address. It offers good protection against malicious users who spoof or change their IP address. Remember that mac filtering only makes sense for packets coming from an Ethernet device and entering the chains:
1. PREROUTING
2. FORWARD
3. INPUT
iptables blocking with mac address
Drop all connection coming from mac address 00:0F:EA:91:04:08 (add command to your firewall script)
iptables -A INPUT -m mac –mac-source 00:0F:EA:91:04:08 -j DROP
iptables allowing with mac address
Allow port 22 for mac address 00:0F:EA:91:04:07
iptables -A INPUT -p tcp –destination-port 22 -m mac –mac-source
00:0F:EA:91:04:07 -j ACCEPT
Read man page of iptables for more information.
Comments
3 Comments so far


























What is even more interesting is that you can use this method to route traffic between interfaces with options like skipto and via interface. Palonek from http://www.paloneks.ca/
Hello.,
How to filter mac for an specific ipaddress, and how to implement,plz help me and mail me
Hello.,
How to filter mac for an specific ipaddress in RHEL, and how to implement,plz help me and mail me thakshina_v@yahoo.com