LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 09-25-2009, 12:40 PM   #1
hertzzmang
LQ Newbie
 
Registered: Sep 2009
Posts: 1

Rep: Reputation: 0
Smile IPTABLES Mac filtering


Hi,

I have IPTABLES setup on a internet gateway/firewall. It is all working but I currently need to set up some sort of filtering so that everyone doesn't get access to the internet.

Currently, IPTABLES is set up to allow anyone behind eth0 on the local network to gain access to the net.

What I would like is to be able to add specific mac addresses into my script and then have a default drop rule (so that if a mac address isn't in the list, it will not be able to access the FORWARD chain to get on the internet).

Only problem is, I have tried making custom chains etc.. to try and get Mac filtering working but I can't seem to work out the correct DROP policy I need to reject non-maclist clients. Not really sure of the order that the rules need to go in (or even the exact rules to use seeing as I have FORWARD rules which are set to ACCEPT.

All chains are set to DROP.
My FORWARD policies are:

$IPT -A FORWARD -i $EXT_IF -o $INT_IF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i $INT_IF -o $EXT_IF -j ACCEPT

Thanks in Advance!
 
Old 09-27-2009, 07:08 AM   #2
centosboy
Senior Member
 
Registered: May 2009
Location: london
Distribution: centos5
Posts: 1,137

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by hertzzmang View Post
Hi,

I have IPTABLES setup on a internet gateway/firewall. It is all working but I currently need to set up some sort of filtering so that everyone doesn't get access to the internet.

Currently, IPTABLES is set up to allow anyone behind eth0 on the local network to gain access to the net.

What I would like is to be able to add specific mac addresses into my script and then have a default drop rule (so that if a mac address isn't in the list, it will not be able to access the FORWARD chain to get on the internet).

Only problem is, I have tried making custom chains etc.. to try and get Mac filtering working but I can't seem to work out the correct DROP policy I need to reject non-maclist clients. Not really sure of the order that the rules need to go in (or even the exact rules to use seeing as I have FORWARD rules which are set to ACCEPT.

All chains are set to DROP.
My FORWARD policies are:

$IPT -A FORWARD -i $EXT_IF -o $INT_IF -m state --state ESTABLISHED,RELATED -j ACCEPT
$IPT -A FORWARD -i $INT_IF -o $EXT_IF -j ACCEPT

Thanks in Advance!

something like this could work

Code:
$IPT -A FORWARD -i $EXT_IF -o $INT_IF -m mac --mac-source XX:XX:XX:XX:XX:XX -j ACCEPT
$IPT -A FORWARD -i $EXT_IF -o $INT_IF -m state --state ESTABLISHED,RELATED -j ACCEPT
or even

Code:
$IPT -A FORWARD -i $EXT_IF -o $INT_IF -m mac --mac-source ! XX:XX:XX:XX:XX:XX -j ACCEPT
$IPT -A FORWARD -i $EXT_IF -o $INT_IF -m state --state ESTABLISHED,RELATED -j ACCEPT
to allow everything but this one address.


or

Code:
$IPT -A FORWARD -i $EXT_IF -o $INT_IF -m mac --mac-source ! XX:XX:XX:XX:XX:XX -j DROP
$IPT -A FORWARD -i $EXT_IF -o $INT_IF -m state --state ESTABLISHED,RELATED -j ACCEPT
to drop everything but that one mac address
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
iptables filtering by MAC address bigsmile Linux - Networking 2 09-27-2008 06:51 PM
iptables + mac address filtering Roko Linux - Networking 1 09-10-2008 07:38 AM
iptables mac filtering Ventrix Linux - Security 1 11-21-2007 07:29 PM
MAC Filtering eggoz Linux - Networking 1 06-11-2006 01:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 05:31 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration