?
Solved

iptables

Posted on 2001-09-14
7
Medium Priority
?
395 Views
Last Modified: 2012-05-04
I need an expamle of how to make a rule with an IP and MAC addressess on iptables for Linux.
0
Comment
Question by:CyberGod
  • 3
  • 2
  • 2
7 Comments
 
LVL 5

Accepted Solution

by:
BlackDiamond earned 300 total points
ID: 6483687
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:CyberGod
ID: 6484413
Can you be more specific about this -m mac --mac-source
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6484736
does
   man iptables
not give you the answer
0
NEW Veeam Backup for Microsoft Office 365 1.5

With Office 365, it’s your data and your responsibility to protect it. NEW Veeam Backup for Microsoft Office 365 eliminates the risk of losing access to your Office 365 data.

 
LVL 5

Expert Comment

by:BlackDiamond
ID: 6485092
CyberGod,
"-m mac" tells iptables that you want to use the built-in mac module, and that module has the --mac-source parameter.  The rule that I showed above would accept anything originating from the 2.3.4.0 subnet that was routed through an interface in the same broadcast domain (on the same subnet) with mac 00:11:22:33:44:55.

As ahoffmann stated, "man iptables" will show you all of these options.
0
 

Author Comment

by:CyberGod
ID: 6485504
iptables -A INPUT -s 2.3.4.5/32 -m mac --mac-source 00:11:22:33:44:55 -j ACCEPT

Does this means that I can accept packets from a NIC with IP 2.3.4.5 and MAC 00:11:22:33:44:55 ? (yes/no)
0
 
LVL 5

Expert Comment

by:BlackDiamond
ID: 6487901
Cybergod, that is correct.  But keep in mind that if you have more than one subnet, then you will need to use ip ranges combined with the MAC of your router interface.  This is because MAC addresses are seen in the same broadcast domain, so you will see the MAC address of the last device to touch the packet (which would be your router).  
0
 
LVL 51

Expert Comment

by:ahoffmann
ID: 6488055
BTW, would be nice to see what happens with such an iptables configuration with clients comming from a TokenRing network (where you need to set the MAC).
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

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

The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
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é.
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses
Course of the Month16 days, 11 hours left to enroll

862 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