Solved

Only Allowing Access From Specific MAC Addresses

Posted on 2002-03-20
15
259 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
ID: 6884857
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
ID: 6885209
Im running RedHat 7.2 I dont seem to have an iptables command what should i use
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6885307
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
ID: 6885422
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
ID: 6885442
by the way what does the 2.3.4.0/24 mean?
0
 
LVL 51

Accepted Solution

by:
ahoffmann earned 300 total points
ID: 6885486
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
ID: 6885509
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 is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

 

Author Comment

by:comahony
ID: 6885519
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
ID: 6885579
i've done that but the box still accepts conntections from any  mac address
0
 

Author Comment

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

Expert Comment

by:Mishou
ID: 6910811
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
ID: 9077049
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
ID: 9077324
IMHO my suggestion works
0
 
LVL 1

Expert Comment

by:drewber
ID: 9220291
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
My bash alias isn't executing 5 49
Linux Scripting 3 102
AWS CLI issues with Tags 3 65
Linux hostname change 2 55
In this tutorial I will explain how to make squid prevent malwares in five easy steps: Squid is a caching proxy for the Web supporting HTTP, HTTPS, FTP, and more. It reduces bandwidth and improves response times by caching and reusing frequently-…
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
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.

895 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

17 Experts available now in Live!

Get 1:1 Help Now