Solved

Only Allowing Access From Specific MAC Addresses

Posted on 2002-03-20
15
258 Views
Last Modified: 2013-12-15
Is the a way of configuring a Linux box to only allow connections from specific MAC addresses in much the same way as the hosts.allow / hosts.deny does for IP addresses?
0
Comment
Question by:comahony
15 Comments
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
AFAIK not by using a simple config file (like /etc/hosts.allow), but iptables can do:

iptables -A INPUT -s 2.3.4.0/24 -m mac --mac-source 00:11:22:33:44:55 -j ACCEPT
0
 

Author Comment

by:comahony
Comment Utility
Im running RedHat 7.2 I dont seem to have an iptables command what should i use
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
Go with iptables, anything else (except comercial software, if available) drives you crazy 'til the hard work is done.
If you still have a 2.4 kernel, simply install the iptables package, otherwise I suggest to upgrade to 2.4
0
 

Author Comment

by:comahony
Comment Utility
ok i ran that command and added my own desktops mac address but people from other mac addresses can still access the box how do I deny access to them?
0
 

Author Comment

by:comahony
Comment Utility
by the way what does the 2.3.4.0/24 mean?
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 300 total points
Comment Utility
oops, just this command used literaly won't work.
Did not not that you're unfamilar with IP, Firewalls etc. sorry.

Use following 3 commands:
iptables -F INPUT
iptables -P INPUT ACCEPT
iptables -A INPUT -s 0.0.0.0 -m mac --mac-source 00:11:22:33:44:55 -j DROP


Keep in mind that you have to replace 00:11:22:33:44:55 by the mac in question.
0.0.0.0 in the last iptables command means that this rule should match any source IP address. When you use 2.3.4.0/24, then this rule only aplies if the source IP is in the range 2.3.4.1 .. 2.3.4.254.
You may add as man rules with different MACs as you like.
0
 

Author Comment

by:comahony
Comment Utility
ok how do i delete that orignal thing i put in from the  
iptables -A INPUT -s 2.3.4.0/24 -m mac --mac-source 00:11:22:33:44:55 -j ACCEPT
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 

Author Comment

by:comahony
Comment Utility
ok how do i delete that orignal thing i put in from the  
iptables -A INPUT -s 2.3.4.0/24 -m mac --mac-source 00:11:22:33:44:55 -j ACCEPT
0
 

Author Comment

by:comahony
Comment Utility
i've done that but the box still accepts conntections from any  mac address
0
 

Author Comment

by:comahony
Comment Utility
i've done that but the box still accepts conntections from any  mac address
0
 
LVL 5

Expert Comment

by:Mishou
Comment Utility
You have them typed in the wrong order

iptables -F INPUT
will flush the INPUT chain

iptables -P INPUT DENY
will set the default for INPUT chain to be DENY

iptables -A INPUT -s 0.0.0.0 -m mac --mac-source 00:11:22:33:44:55 -j ACCEPT
will Add a new rule to your INPUT policy that specify to accept traffic only from that specific MAC address

Mishou
0
 

Expert Comment

by:CleanupPing
Comment Utility
comahony:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 51

Expert Comment

by:ahoffmann
Comment Utility
IMHO my suggestion works
0
 
LVL 1

Expert Comment

by:drewber
Comment Utility
This question has been classified abandoned. I will make a recommendation to the moderators on its resolution in a week or two. I appreciate any comments that would help me to make a recommendation.
 

Unless it is clear to me that the question has been answered I will recommend delete. It is possible that a Grade less than A will be given if no expert makes a case for an A grade. It is assumed that any participant not responding to this request is no longer interested in its final disposition.

 
If the user does not know how to close the question, the options are here:
http://www.experts-exchange.com/help/closing.jsp
 
drewber
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now