Linux Netfilter discussions
 help / color / mirror / Atom feed
From: Ramin Dousti <ramin@cannon.eng.us.uu.net>
To: Chris Frederick <cdf123@cdf123.com>
Cc: netfilter@lists.netfilter.org
Subject: Re: iptables port forwarding not working
Date: Fri, 27 Jun 2003 14:32:59 -0400	[thread overview]
Message-ID: <20030627183259.GE11167@cannon.eng.us.uu.net> (raw)
In-Reply-To: <3EFC878D.50304@cdf123.com>

On Fri, Jun 27, 2003 at 01:06:05PM -0500, Chris Frederick wrote:

> I need some help with an iptables script.  I'm trying to forward port 80 
> on the Firewall/NAT/Router to another machine inside the firewall.  I've 
> googled for some scripts and found the PREROUTING lines that are needed, 
> but it doesn't seem to work.  The port isn't open on the machine.  I've 
> attached a sample script bellow that sums up what I'm doing.  Any 
> sugestions?
> 
> INET_IP="1.1.1.1"
> INET_IFACE="eth1"
> INET_BROADCAST="1.1.1..255"
> 
> LAN_IP="2.2.2.2"
> LAN_IP_RANGE="2.2.2.0/24"
> LAN_BROADCAST_ADDRESS="2.2.2.255"
> LAN_IFACE="eth0"
> 
> LO_IFACE="lo"
> LO_IP="127.0.0.1"
> 
> DNAT_IP_PORT="2.2.2.3:80"
> 
> #Forward the HTTP trafice from the net to the server at 2.2.2.3
> $IPTABLES -t nat -A PREROUTING -p tcp -i $INET_IFACE -d $INET_IP --dport 
> 80 -j DNAT --to $DNAT_IP_PORT
> $IPTABLES -A FORWARD -p tcp -i $INET_IFACE -d $INET_IP --dport 80 -j ACCEPT

In PREROUTING you change the dst to 2.2.2.3 but in the forward you allow
1.1.1.1. This is at least one problem you have in your script.

You also say that you get the indication of the port not being open on the
machine. How do you assert this statement?

> On a side note, once I get this working, I'm planning on forwarding
> HTTPS to another machine, and also forwarding SSH on a non-standard port
> to another machine (e.g.  port 999 to 22).  Are there any issues with
> doing this?  Like, say the HTTPS or SSH certs looking like they're
> comming from a different ip and causing errors trying to connect?  Or
> will I get key change errors from the server (since I connect to SSH on
> 22 and 999 on the same ip) every time I connect to the other one?   Or
> am I overthinking this, and it all just works?


ssh will not have a problem but https will, because of the issued cert...

Ramin


  reply	other threads:[~2003-06-27 18:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-06-27 18:06 iptables port forwarding not working Chris Frederick
2003-06-27 18:32 ` Ramin Dousti [this message]
2003-06-27 19:08   ` Chris Frederick
2003-06-27 20:07     ` Ramin Dousti

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=20030627183259.GE11167@cannon.eng.us.uu.net \
    --to=ramin@cannon.eng.us.uu.net \
    --cc=cdf123@cdf123.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