Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Frédéric Gonzatti" <fred99@libertysurf.fr>
To: netfilter@lists.netfilter.org
Subject: Forward a port ??!!
Date: Tue, 20 Jul 2004 21:47:26 +0200	[thread overview]
Message-ID: <40FD76CE.6050501@libertysurf.fr> (raw)

Hi all,

I''ve got a firewall with three cards : eth0 (LAN), eth1(DMZ) and eth2 
(WAN).
I'm trying to test port forward with iptables but it doesn't work !
eth0 : 172.168.2.1 (I'm not using this card now)
eth1: 192.168.2.1/255.255.255.0
eth2: 192.168.3.1/255.255.255.0

On the DMZ I've put a computer (192.168.2.151/255.255.255.0) with sendmail.
When I'm on this computer a telnet localhost 25 is working fine.
I've connected a computer on eth2 with ip 192.168.3.2/255.255.255.0
I would like to access to the computer with sendmail when I make a 
telnet 192.168.3.1 but I've got a timeout response.

My iptables script is :
#!/bin/sh

echo 1 > /proc/sys/net/ipv4/ip_forward

modprobe ip_tables
modprobe ip_nat_ftp
modprobe iptable_filter
modprobe iptable_nat

iptables -F
iptables -X

iptables -N LOG_ACCEPT
iptables -A LOG_ACCEPT -j LOG --log-prefix '[IPTABLES ACCEPT] : '
iptables -A LOG_ACCEPT -j ACCEPT

iptables -P INPUT DROP
iptables -P OUTPUT DROP
iptables -P FORWARD ACCEPT

iptables -A INPUT -i lo -j ACCEPT
iptables -A OUTPUT -o lo -j ACCEPT

iptables -t nat -A PREROUTING -d 192.168.3.1 -p tcp --dport 25 -j DNAT 
--to-destination 192.168.2.151:25

iptables -A FORWARD -i eth2 -o eth1 -p tcp --destination-port 25 -m 
state --state NEW,ESTABLISHED -j ACCEPT
iptables -A FORWARD -o eth2 -i eth1 -p tcp --source-port 25 -m state 
--state ESTABLISHED -j ACCEPT

iptables -A FORWARD -j DROP
iptables -A INPUT -j DROP
iptables -A OUTPUT -j DROP

What it's wrong with this script ?

Thanks

    Frederic




             reply	other threads:[~2004-07-20 19:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-20 19:47 Frédéric Gonzatti [this message]
2004-07-20 20:55 ` Forward a port ??!! Antony Stone

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=40FD76CE.6050501@libertysurf.fr \
    --to=fred99@libertysurf.fr \
    --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