From: Boryan Yotov <yotov@prosyst.com>
To: netfilter@lists.netfilter.org
Subject: Re: MAC/IP PAIR MATCH
Date: Mon, 30 Jan 2006 18:30:35 +0100 [thread overview]
Message-ID: <43DE4D3B.8080106@prosyst.com> (raw)
In-Reply-To: <10310383401.20060128161251@gorontalo.net>
Iwan Fauzie wrote:
> Hello Boryan,
>
> Thanks for you help Boryan.
>
> Please see http://www.netservers.co.uk/gpl/ this patch IPtables MAC/IP
> pair match
>
> This patch to help prevent users from:
>
> - users have not changed their IP address to conflict with or spoof
> others users
> - Users have not changed their MAC address (e.g. new network cards
> MAC spoofing or NAT)
>
>
> Friday, January 27, 2006, 9:17:48 PM, you wrote:
>
>
>>Iwan Fauzie wrote:
>>
>>>Hello,
>>>
>>>I would like to patch mac/ip pair match, how to do that? any body help me
>>>
>
>
>>If you want to match IP against MAC address, then check the iptables's
>>_mac_ match:
>
>
>># iptables -m mac -help
>
>
>>Example: rule for forwarding packets matching certain IP/MAC pair is:
>
>
>># iptables -A FORWARD -s <IP _address> -m -mac --mac-source <MAC
>
> address>> -j ACCEPT
>
>
>>... but if you want to "patch a match", then you need to specify a bit
>>more detailed what are you trying to do.
>
>
>>The _mac_ match exist into the default iptables source (./extensions)
>>e.g. you don't need to patch anything. Just install iptables and enable
>>the match inside your kernel's .config file (CONFIG_IP_NF_MATCH_MAC=y)
>>and finally recompile (and install) the new kernel.
>
>
Personally I never used the iptables patch you mentioned above.
But looking at its tarball content it seems to be a 2.4.xx kernel
patch, for a kernel patched with iptables (probably 1.2.x).
Follow this steps (not the smartest one) in order to install it:
=================================================================
STEP 1: Patching the kernel
=================================================================
The file with the sources (macmatch.patch) is a diff on a patched
kernel, so you could apply it to an existing kernel tree easily.
Just go to where you current kernel source is located (I suppose
it is into:
# cd /usr/src/linux
Make sure it is already patched with iptables (recent kernels are
by default). To apply the "macmatch.patch" patch simply type:
# patch -p1 < /<Patch_Location >/macmatch.patch
The result from the patch command must look like:
patching file include/linux/netfilter_ipv4/ipt_macmatch.h
patching file net/ipv4/netfilter/ipt_macmatch.c
The configuration and make files are not a diff, so the fastest
way to apply them, is to edit the corresponding files manually:
-----------------------------------------------------------------
"macmatch.patch.config.in"
-----------------------------------------------------------------
Its content goes to "/usr/src/linux/net/ipv4/netfilter/Config.in"
Find the line from "Config.in" which says:
dep_tristate ' MAC address match support' CONFIG_IP_NF_MATCH_MAC
$CONFIG_IP_NF_IPTABLES
... and replace it (the line only) with the content of the
macmatch.patch.config.in:
dep_tristate ' MAC address match support' CONFIG_IP_NF_MATCH_MAC
$CONFIG_IP_NF_IPTABLES
dep_tristate ' MAC/IP pair match support'
CONFIG_IP_NF_MATCH_MACMATCH $CONFIG_IP_NF_IPTABLES
-----------------------------------------------------------------
"macmatch.patch.makefile"
-----------------------------------------------------------------
Its content goes to "/usr/src/linux/net/ipv4/netfilter/Makefile"
Find the line from "Makefile" which says:
obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o
... and replace it (the line only) with the content of the
macmatch.patch.makefile:
obj-$(CONFIG_IP_NF_MATCH_MAC) += ipt_mac.o
obj-$(CONFIG_IP_NF_MATCH_MACMATCH) += ipt_macmatch.o
-----------------------------------------------------------------
"macmatch.patch.configure.help"
-----------------------------------------------------------------
This is optional and only for convenience. You'll need it if you
want a help entry for the macmatch kernel configuration option.
Its content (starting from the second line) should go as an entry
into "/usr/src/linux/Documentation/Configure.help".
=================================================================
STEP 2: Patching iptables
=================================================================
Once you have you kernel tree ready its time to let know iptables
about the macmatch existence:
Go to your iptables source tree location. I'll suppose it is into
#cd /usr/local/src/iptables-1.xx.yy
Copy both "libipt_macmatch.c" and ".macmatch-test" files from the
macmatch tree into:
#cp <file1> <file2> /usr/local/src/iptables-1.xx.yy/extensions
And finally compile and install iptables.
make KERNEL_DIR=/usr/src/linux
make install KERNEL_DIR=/usr/src/linux
=================================================================
STEP 3: Enable the patch into the kernel config file
=================================================================
Add the following line into "/usr/src/linux/.config" :
CONFIG_IP_NF_MATCH_MACMATCH=y
... in order to build the patch static into the kernel
or
CONFIG_IP_NF_MATCH_MACMATCH=m
... if you need it as loadable module.
Finally recompile the kernel, load it and reboot.
Hope this helps.
next prev parent reply other threads:[~2006-01-30 17:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-27 7:52 MAC/IP PAIR MATCH Iwan Fauzie
2006-01-27 14:17 ` Boryan Yotov
2006-01-28 9:12 ` Re[2]: " Iwan Fauzie
2006-01-30 17:30 ` Boryan Yotov [this message]
2004-01-21 5:46 ` Iwan Fauzie
2006-01-30 19:43 ` Sorin Panca
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=43DE4D3B.8080106@prosyst.com \
--to=yotov@prosyst.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox