All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Marcos S. Trazzini" <mstrazzini@gmail.com>
To: netfilter@lists.netfilter.org
Subject: Re: IP and MAC Address check
Date: Wed, 5 Oct 2005 01:58:22 -0300	[thread overview]
Message-ID: <20051005045822.GA5636@mobilion> (raw)
In-Reply-To: <005d01c5c964$b7ccebe0$580110ac@HO.lippogeneral.com>

On Wed, Oct 05, 2005 at 11:24:46AM +0700, Winanjaya - PBXSoftwares wrote:
> Hi All,
> 
> I have list of Mac addresses and also have range of IP addresses.. how to set iptables with conditions below:
> 
> Range of IP addresses: 172.16.2.241 to 172.16.2.250
> 
> List of MAC Addresses: (stored in a file named maclist)
> 01:02:03:04:05:0a
> 01:02:03:04:05:0b
> 01:02:03:04:05:0c
> 01:02:03:04:05:0d
> 01:02:03:04:05:0e
> 01:02:03:04:05:0f
> 01:02:03:04:05:1a
> 01:02:03:04:05:2a
> 01:02:03:04:05:3a
> 01:02:03:04:05:4a
> 
> When Incoming package from the ranged IP address (172.16.2.241 to 172.16.2.250)  then the mac address must be checked from the list of MAC Address, if the MAC Address matched then it allowed otherwise it will be rejected or dropped..
 
Hi All,

This's my first reply to the list (And I wan't to send a lot more...), and
expect to help. Sorry for the the bad english (Need's a litle practice).

Can't you associate each IP with a MAC address from the list? It's the best thing
to do (as it is the most secure...).

Or.... maybe this is that you want:

---CUT HERE---
while read mac; do
  iptables -A INPUT -m mac --mac-source $mac -m iprange --src-range \
   172.16.2.241-172.16.2.250 -j ACCEPT
done < /path/to/maclist
iptables -AINPUT -m iprange --src-range 172.16.2.241-172.16.2.250 -j DROP
---CUT HERE---

This will create a lot of rules (One per MAC address from the list) instead of only one "wonderful rule". Of course the rules must be "best worked", but maybe this can solve the problem.

See also:
# iptables -m mac --help
# iptables -m iprange --help

--
Marcos S. Trazzini


  reply	other threads:[~2005-10-05  4:58 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-10-05  4:24 IP and MAC Address check Winanjaya - PBXSoftwares
2005-10-05  4:58 ` Marcos S. Trazzini [this message]
2005-10-05  5:19   ` Winanjaya - PBXSoftwares
2005-10-05  5:23     ` Ruben Cardenal
2005-10-05  5:27     ` hareram
2005-10-05  5:29     ` /dev/rob0
2005-10-05  5:50       ` Winanjaya - PBXSoftwares
2005-10-05  6:23         ` /dev/rob0
2005-10-05  6:44           ` Winanjaya - PBXSoftwares
2005-10-05  7:13             ` Rob Sterenborg
2005-10-05  7:52               ` Winanjaya - PBXSoftwares
2005-10-05  8:11                 ` Rob Sterenborg
  -- strict thread matches above, loose matches on Subject: below --
2005-10-05  5:31 Winanjaya - PBXSoftwares

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20051005045822.GA5636@mobilion \
    --to=mstrazzini@gmail.com \
    --cc=netfilter@lists.netfilter.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.