Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Aleksandar Milivojevic <amilivojevic@pbl.ca>
To: netfilter@lists.netfilter.org
Subject: Re: -m helper --helper -irc
Date: Tue, 17 Aug 2004 14:35:27 -0500	[thread overview]
Message-ID: <41225DFF.3060801@pbl.ca> (raw)
In-Reply-To: <51382563.20040817200441@op.pl>

Marcin Sura wrote:
> Hi
> 
>   I use following rule for marking irc dcc transfers from my NATed lan.
> 
>   iptables -t mangle -A PREROUTING -p tcp -m helper --helper irc \
>   -m mark --mark 0 -j MARK --set-mark 1
> 
>   And this works perfectly when I send a file to somebody, and doesn't
>   when somebody sends something to me. Why?

Not quite sure what you are trying to achieve with above rule.  And hard 
to say what you are doing without looking at the rest of your rules 
(what are those marks used for???).  Why did you need mangle table if 
all you have is simple NATed LAN?

Haven't used irc module, however, taking analogy with ftp module, I 
would probably try something like this (modify to match your network 
configuration):

# I doubt this one is loaded automatically
modprobe ip_nat_irc

# Let assume you implemented masquerading something like this,
# like most people do...
iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

# IRC is 6666?  Or was it 6667?  Or was it port range?
# Modify as needed...
iptables -A FORWARD -p tcp --sport 1024: --dport 6666 \
    -s 192.168.0.0/16 -m state --state NEW,ESTABLISHED -j ACCEPT
iptables -A FORWARD -p tcp --sport 6666 --dport 1024: \
    -d 192.168.0.0/16 -m state --state ESTABLISHED -j ACCEPT

# DCC.  This works for FTP, I would guess IRC DCC should be the same
iptables -A FORWARD -p tcp --sport 1024: --dport 1024: \
    -m helper --helper irc \
    -m state --state RELATED,ESTABLISHED -j ACCEPT

I assumed that all DCCs are from high ports to high ports (like passive 
FTP data connection).  This example isn't particulary strict.  You may 
make it tighter as needed.

-- 
Aleksandar Milivojevic <amilivojevic@pbl.ca>    Pollard Banknote Limited
Systems Administrator                           1499 Buffalo Place
Tel: (204) 474-2323 ext 276                     Winnipeg, MB  R3T 1L7


  reply	other threads:[~2004-08-17 19:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-17 18:04 -m helper --helper -irc Marcin Sura
2004-08-17 19:35 ` Aleksandar Milivojevic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2004-08-17 19:46 Jason Opperisano

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=41225DFF.3060801@pbl.ca \
    --to=amilivojevic@pbl.ca \
    --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