public inbox for linux-newbie@vger.kernel.org
 help / color / mirror / Atom feed
From: Ray Olszewski <ray@comarre.com>
To: chuck@gelm.net, linux-newbie@vger.kernel.org
Subject: Re: 'ssh' uses port 20 only?
Date: Tue, 04 Jan 2005 10:53:53 -0800	[thread overview]
Message-ID: <5.1.0.14.1.20050104104237.021c9f00@celine> (raw)
In-Reply-To: <41DAD832.7030302@gelm.net>

At 12:53 PM 1/4/2005 -0500, chuck gelm wrote:

>Howdy, Y'all:
>
>  My brother and I are on separate networks
>(I am in Ohio and he is in Oklamoma, ~1600 miles apart).
>I am trying to allow my brother to 'ssh' with a host inside my LAN.
>On my router I am NAT'ing only port 22; via IPTABLES thusly:
>
># forward ssh (22) to 'server'
>/usr/sbin/iptables -t nat -A PREROUTING -i eth1 -p tcp --dport 22 -j DNAT 
>--to 192.168.0.84
>/usr/sbin/iptables -t nat -A PREROUTING -i eth1 -p udp --dport 22 -j DNAT 
>--to 192.168.0.84
>
>  I can 'ssh' into my brother's host inside his LAN, but he is
>NAT'ing ports 20 through 23 (ftp, ssh, & telnet).  Does 'ssh'
>also use ports 20,21, and/or 23 ?

No. 20 and 21 are ftp. 23 is telnet. ssh uses none of them.

>Do I need to NAT more ports?

No.

But you *do* (probably; actually, it depends on the rest of the ruleset) 
need to add an entry to the FORWARD table, one something like this:

         iptables -A FORWARD -i eth1 -p tcp --dport 22 -j ACCEPT

(I infer from your DNAT rule that eth1 is your external interface.) You 
*probably* have a FORWARD-table rule or policy blocking all originating 
connections from the outside, and this rule needs to precede that one so 
port 22 will be an exception to it.

Were I you, I would consider modifying this rule so it only ACCEPTed ssh 
traffic originating from your brother's source IP address ... but you need 
to make your own security decisions, so I offer that only as a suggestion.

>Here is my brother's portion of IPTABLES, which works remotely for me:
>
># forward ftp,ssh,telnet
>/usr/sbin/iptables -t nat -A PREROUTING -i eth0 -p tcp --dport 20:23 -j 
>DNAT --to 192.168.0.48
>/usr/sbin/iptables -t nat -A PREROUTING -i eth0 -p udp --dport 20:23 -j 
>DNAT --to 192.168.0.48
>
>'man ssh' did not indicate any port numbers.
>
>I can 'ssh' with my host via eth0, so 'ssh' is working on the
>intended host.
>Regards, Chuck





-- 
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.296 / Virus Database: 265.6.7 - Release Date: 12/30/2004


-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

      reply	other threads:[~2005-01-04 18:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-31  4:55 retrieval Ankit Jain
2004-12-31  5:06 ` retrieval Amit Dang
2005-01-07  8:58   ` retrieval Ankit Jain
2005-01-07 14:13     ` retrieval chuck gelm
2005-01-01  6:06 ` retrieval Peter
2005-01-01 13:59   ` retrieval Ohadi, Hamid
2005-01-02  8:01     ` retrieval joy merwin monteiro
2005-01-02  8:32       ` Do not delete files by mistake (was Re: retrieval) Ulrich Fürst
2005-01-03  6:33         ` Richard Adams
2005-01-03 18:14           ` Ulrich Fürst
2005-01-04 17:53           ` 'ssh' uses port 20 only? chuck gelm
2005-01-04 18:53             ` Ray Olszewski [this message]

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=5.1.0.14.1.20050104104237.021c9f00@celine \
    --to=ray@comarre.com \
    --cc=chuck@gelm.net \
    --cc=linux-newbie@vger.kernel.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