Linux Netfilter discussions
 help / color / mirror / Atom feed
From: "Fernando La Gamba" <fernando.lagamba@fastrack.com.br>
To: netfilter@lists.netfilter.org
Subject: redirect connec to ex int to int
Date: Tue, 22 Jul 2003 15:08:10 -0300	[thread overview]
Message-ID: <00bf01c3507c$35db5800$6200000a@detec10> (raw)

[-- Attachment #1: Type: text/plain, Size: 1900 bytes --]

I'm trying to redirect connections from outside (external interface) to a
internal machine (192.168.200.252), but i dont know why, nothing happend.

Someone can tell me whats wrong with this rules?

#!/bin/bash

export IPTABLES=/usr/local/sbin/iptables
export MODPROBE=/sbin/modprobe

$MODPROBE ip_nat_ftp
$MODPROBE ip_conntrack
$MODPROBE ip_conntrack_ftp
$MODPROBE ipt_string
echo 1 > /proc/sys/net/ipv4/ip_forward

$IPTABLES -F
$IPTABLES -F -t nat
$IPTABLES -F -t mangle
$IPTABLES -X
$IPTABLES -Z

echo "- Enabling SNAT (MASQUERADE) funtionality on eth0"

#<INTERFACES>
IF_EXT=eth0
IF_INT=eth1
#</INTERFACES>

#<REDES>
ANY=0.0.0.0/0
NET_INT=192.168.0.0/16
#</REDES>

#<sERVIDOR WEB>
IP_WEB_INT=192.168.200.252
IP_WEB_EXT=200.X.X.X
#</sERVIDOR WEB>


$IPTABLES -N EXT_SRVWEB
$IPTABLES -A EXT_SRVWEB -p tcp -s $ANY --sport 1024: -d $IP_WEB_INT --dport
10001 -i $IF_EXT -o $IF_INT -j ACCEPT
$IPTABLES -A EXT_SRVWEB -j DROP

$IPTABLES -N SRVWEB_EXT
$IPTABLES -A SRVWEB_EXT -p tcp -s $IP_WEB_INT --sport 10001 -d $ANY --dport
1024: -i $IF_INT -o $IF_EXT -j ACCEPT
$IPTABLES -A SRVWEB_EXT -j DROP

$IPTABLES -t nat -A PREROUTING -d $IP_WEB_EXT -j DNAT --to $IP_WEB_INT -i
$IF_EXT

$IPTABLES -A FORWARD -j EXT_SRVWEB -s $ANY      -d $IP_WEB_INT -i $IF_EXT -o
$IF_INT
$IPTABLES -A FORWARD -j SRVWEB_EXT -s $IP_WEB_INT -d $ANY      -i $IF_INT -o
$IF_EXT

$IPTABLES -A POSTROUTING -t nat -s $IP_WEB_INT -d $ANY -j SNAT --to
$IP_WEB_EXT -o $IF_EXT
$IPTABLES -A POSTROUTING -t nat -j MASQUERADE -s $NET_INT -o $IF_EXT

Thanks
____________________________
Fastrack Soluções e Sistemas
Fernando La Gamba
Network Admin / Security
Com.: 5506-6044 R. 614
Cel.: 9214-2176


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.501 / Virus Database: 299 - Release Date: 14/7/2003

[-- Attachment #2: Type: text/html, Size: 3514 bytes --]

                 reply	other threads:[~2003-07-22 18:08 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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='00bf01c3507c$35db5800$6200000a@detec10' \
    --to=fernando.lagamba@fastrack.com.br \
    --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