From: Raymond Leach <raymondl@knowledgefactory.co.za>
To: louie miranda <lmiranda@chikka.com>
Cc: Netfilter Mailing List <netfilter@lists.netfilter.org>
Subject: Re: portfw on iptables 2.4 kernel problem.
Date: 11 Dec 2002 08:20:06 +0200 [thread overview]
Message-ID: <1039587605.1714.131.camel@rayw.knowledgefactory.co.za> (raw)
In-Reply-To: <00d301c2a0db$c8c2b240$0b00000a@nocpc3>
[-- Attachment #1: Type: text/plain, Size: 4277 bytes --]
Here are the rules I use for ftp outbound from my internal network :
IPTABLES="/usr/sbin/iptables"
NET_INT="10.0.0.0/24"
IFACE_INET="eth0"
IFACE_INT="eth2"
IFACE_DMZ="eth1"
IFACE_LOC="lo"
$ip="10.0.0.67" # My workstation ip
$IPTABLES -A FORWARD -i $IFACE_INT -p tcp --dport 20:21 -s $ip -m state
--state NEW,ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $IFACE_INT -p tcp --dport 1024: -s $ip
-m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $IFACE_INT -p udp --dport 1024: -s $ip
-m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $IFACE_INET -p tcp --sport 20:21 -d $ip -m state
--state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $IFACE_INET -p tcp --sport 1024: -d $ip
-m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -A FORWARD -i $IFACE_INET -p udp --sport 1024: -d $ip
-m state --state ESTABLISHED,RELATED -j ACCEPT
$IPTABLES -t nat -A POSTROUTING -o $IFACE_INET -p tcp --dport 20:21 -s
$ip -j SNAT --to-source $IP_INET
$IPTABLES -t nat -A POSTROUTING -o $IFACE_INET -p tcp --dport
1024: -s $ip -j SNAT --to-source $IP_INET
Enjoy!
Ray
On Wed, 2002-12-11 at 08:08, louie miranda wrote:
> Hi, thanks for all your replies, etc. But my problem is not yet solved. I
> dont know why?!
> Can someone give me how did they did it?
>
>
>
> --
> thanks,
> louie miranda
>
>
> ----- Original Message -----
> From: "Jozsef Kadlecsik" <kadlec@blackhole.kfki.hu>
> To: "Raymond Leach" <raymondl@knowledgefactory.co.za>
> Cc: <rsterenborg@xs4all.nl>; "'Paulo Andre'" <pandre@darkstar.nom.za>;
> "'louie miranda'" <lmiranda@chikka.com>; "'netfilter'"
> <netfilter@lists.netfilter.org>
> Sent: Tuesday, December 10, 2002 7:22 PM
> Subject: RE: portfw on iptables 2.4 kernel problem.
>
>
> > On 10 Dec 2002, Raymond Leach wrote:
> >
> > > Yes, you do. Port 20 (and/or any other) connections after the control
> > > connection are not 'RELATED, ESTABLISHED' to the control connection.
> > > They are new connections either from the client to the server or vice
> > > versa. You therefore need seperate rules for them.
> >
> > If we are speaking about the data channels of the supported protocols
> > (FTP, IRC and all the other protocols from p-o-m), then this is absolutely
> > false.
> >
> > > Remember connection tracking happens at a pakcet level, i.e all states
> > > relate to packets of a connection, not per protocol.
> >
> > In the case of the supported protocols with additional channels, again,
> > untrue. Please do no spread false info! Why would then the RELATED state
> > exist?
> >
> > > > However, I'm not sure if it's better to split them up into 2 rules :
> > > > iptables -A FORWARD -i eth0 -o eth1 -p tcp --dport 21 -m state --state
> > > > NEW -j ACCEPT
> > > > iptables -A FORWARD -i eth0 -o eth1 -m state --state
> ESTABLISHED,RELATED
> > > > -j ACCEPT
> >
> > Because the destination port of the data channels cannot be port 21,
> > therefore you must use two rules. And because you specify the
> > incoming/outgoing interfaces, you need a third rule for the reply packets
> > as well.
> >
> > Regards,
> > Jozsef
> > -
> > E-mail : kadlec@blackhole.kfki.hu, kadlec@sunserv.kfki.hu
> > PGP key : http://www.kfki.hu/~kadlec/pgp_public_key.txt
> > Address : KFKI Research Institute for Particle and Nuclear Physics
> > H-1525 Budapest 114, POB. 49, Hungary
> >
> >
> >
--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
( Raymond Leach )
) Knowledge Factory (
( )
) Tel: +27 11 445 8100 (
( Fax: +27 11 445 8101 )
) (
( http://www.knowledgefactory.co.za/ )
) http://www.saptg.co.za/ (
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
o o
o o
.--. .--.
| o_o| |o_o |
| \_:| |:_/ |
/ / \\ // \ \
( | |) (| | )
/`\_ _/'\ /'\_ _/`\
\___)=(___/ \___)=(___/
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
next prev parent reply other threads:[~2002-12-11 6:20 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <FD8F124A387AD6119F7900A0D218B321561982@hslex01.hslbz.local>
2002-12-10 9:43 ` portfw on iptables 2.4 kernel problem Rob Sterenborg
2002-12-10 11:00 ` Raymond Leach
2002-12-10 11:22 ` Jozsef Kadlecsik
2002-12-10 11:32 ` Raymond Leach
2002-12-10 11:52 ` Jozsef Kadlecsik
2002-12-10 12:12 ` Raymond Leach
2002-12-11 6:08 ` louie miranda
2002-12-11 6:20 ` Raymond Leach [this message]
[not found] <96C102324EF9D411A49500306E06C8D1021AE462@eketsv02.cubis.de >
2002-12-12 8:51 ` Rasmus Reinholdt Nielsen
2002-12-12 14:25 ` Joel Newkirk
2002-12-12 8:09 Reckhard, Tobias
-- strict thread matches above, loose matches on Subject: below --
2002-12-12 7:33 Reckhard, Tobias
2002-12-12 7:31 Reckhard, Tobias
2002-12-11 9:00 Reckhard, Tobias
2002-12-11 14:25 ` Joel Newkirk
2002-12-11 7:32 Reckhard, Tobias
2002-12-11 8:05 ` Joel Newkirk
2002-12-10 8:56 louie miranda
2002-12-10 9:01 ` Raymond Leach
2002-12-10 9:11 ` louie miranda
2002-12-10 9:01 ` Paulo Andre
2002-12-10 9:12 ` louie miranda
2002-12-11 11:26 ` Andrea Rossato
2002-12-12 3:11 ` louie miranda
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=1039587605.1714.131.camel@rayw.knowledgefactory.co.za \
--to=raymondl@knowledgefactory.co.za \
--cc=lmiranda@chikka.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