Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 269
  • Last Modified:

Only Allowing Access From Specific MAC Addresses

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
comahony
Asked:
comahony
1 Solution
 
ahoffmannCommented:
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
 
comahonyAuthor Commented:
Im running RedHat 7.2 I dont seem to have an iptables command what should i use
0
 
ahoffmannCommented:
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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
comahonyAuthor Commented:
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
 
comahonyAuthor Commented:
by the way what does the 2.3.4.0/24 mean?
0
 
ahoffmannCommented:
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
 
comahonyAuthor Commented:
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
 
comahonyAuthor Commented:
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
 
comahonyAuthor Commented:
i've done that but the box still accepts conntections from any  mac address
0
 
comahonyAuthor Commented:
i've done that but the box still accepts conntections from any  mac address
0
 
MishouCommented:
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
 
CleanupPingCommented:
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
 
ahoffmannCommented:
IMHO my suggestion works
0
 
drewberCommented:
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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now