From: "Matthew Hellman" <mhellman@raccoon.com>
To: George Georgalis <georgw@galis.org>, netfilter@lists.samba.org
Subject: Re: ssh connecting to wrong machine....
Date: Sun, 2 Jun 2002 21:58:14 -0500 [thread overview]
Message-ID: <002c01c20aaa$812e04b0$020aa8c0@matttm9svd8lrh> (raw)
In-Reply-To: 20020602192157.A16556@trot.haven.dom
George,
The general rule for ip/port forwarding to internal machine is simple. You
have one PREROUTING rule that changes the destination address/port. You
then have one FORWARD rule that allows the packets to be forwarded (because
you are, or should be, by default dropping everything in the FORWARD chain).
> iptables -t nat -A PREROUTING -p tcp -s $EXT_host04 -j
DNAT --to-destination $LAN_host04
This is the major problem. If you're connection from a host on the Internet
the source address is not going to be your firewall. Change this line to:
iptables -t nat -A PREROUTING -p tcp -j DNAT --to-destination $LAN_host04
I would consider tightening up your forward rules as well:
> iptables -A FORWARD -i $EXTIF -o $LANIF -p tcp -m multiport --dport
$TCP_OPEN -m state --state NEW,RELATED,ESTABLISHED -j ACCEPT
Might I suggest doing something similar to what you did for the input rules:
iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
iptables -A FORWARD -i $EXTIF -o $LANIF -d $LAN_host04 -p tcp -m
multiport --dport $TCP_OPEN -m state --state NEW -j ACCEPT
iptables -A FORWARD -i $EXTIF -o $LANIF -d $LAN_host04 -p udp -m
multiport --dport $UDP_OPEN -m state --state NEW -j ACCEPT
Notice I added the "-d $LAN_host04"....very important restriction.
Also, what is UDP port 22 for? Is your firewall running all the same
services as $LAN_host04? You are allowing the same access to it.
Goodluck,
Matt
next prev parent reply other threads:[~2002-06-03 2:58 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-06-02 23:21 ssh connecting to wrong machine George Georgalis
2002-06-03 2:58 ` Matthew Hellman [this message]
2002-06-03 5:05 ` George Georgalis
2002-06-03 12:13 ` Matthew Hellman
2002-06-03 20:57 ` George Georgalis
2002-06-03 3:04 ` George Georgalis
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='002c01c20aaa$812e04b0$020aa8c0@matttm9svd8lrh' \
--to=mhellman@raccoon.com \
--cc=georgw@galis.org \
--cc=netfilter@lists.samba.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