Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Jasbir Khehra <jasbir.k@gmail.com>
To: Branko Kokanovic <branko.kokanovic@gmail.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: drop by mac address, but only to packets to other interface
Date: Wed, 08 Nov 2006 13:22:31 +0530	[thread overview]
Message-ID: <45518CBF.2010907@gmail.com> (raw)
In-Reply-To: <91ff8a190611071639s27882dfatdc39cdcb8f222e5d@mail.gmail.com>

Branko Kokanovic wrote:

> hi all,
> I'm pretty layman on this topic. I have two interfaces, one in local
> network (192.168.0.0) and other to isp. Now, I want to block certain
> mac address from local network from reaching internet, but i want to
> allow him to reach server (for samba, etc...). I tried several
> commands, read on manuals, but all I can get is either all or none
> (either that mac address have internet access and server access, or he
> can't get to internet and server at all ("server" is at 192.168.0.1))
>
> I hope I said all relevant details, if not, ask me and I'll try to tell
>
> Here is my script I use, if that can help a bit:
> ................
> $IPTABLES -P INPUT ACCEPT
> $IPTABLES -F INPUT
> $IPTABLES -P OUTPUT ACCEPT
> $IPTABLES -F OUTPUT
> $IPTABLES -P FORWARD DROP
> $IPTABLES -F FORWARD
> $IPTABLES -t nat -F
>
> $IPTABLES -A FORWARD -i $EXTIF -o $INTIF -m state --state
> ESTABLISHED,RELATED -j ACCEPT
> $IPTABLES -A FORWARD -i $INTIF -o $EXTIF -j ACCEPT
> $IPTABLES -A FORWARD -j LOG
>
> $IPTABLES -t nat -A POSTROUTING -o $EXTIF -j MASQUERADE
>
>
> # I tried this
> #iptables -A PREROUTING -t nat -p ALL -m mac --mac-source
> 00:15:F2:33:B5:92 -j DROP

No need for this rule .This drops all packets both inbound for your 
server and outbound through your server to the Internet

> # and this
> #iptables -A FORWARD -p ALL -m mac --mac-source 00:15:F2:33:B5:92 -j DROP

The rule is correct  but it wont match any packets because packets 
matching this mac address are also matching the earlier "-i $INTIF -o 
$EXTIF -j ACCEPT" rule. Just be careful of the flow. Change "-A" to "-I"
HTH,
Jasbir.

>
>
> Thanks in advance, Branko Kokanovic
>
>



      reply	other threads:[~2006-11-08  7:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-08  0:39 drop by mac address, but only to packets to other interface Branko Kokanovic
2006-11-08  7:52 ` Jasbir Khehra [this message]

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=45518CBF.2010907@gmail.com \
    --to=jasbir.k@gmail.com \
    --cc=branko.kokanovic@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox