Networking Forums

Networking Forums > Computer Networking > Linux Networking > ssh to machines behind firewall?

Reply
Thread Tools Display Modes

ssh to machines behind firewall?

 
 
Grant Edwards
Guest
Posts: n/a

 
      04-29-2004, 07:41 PM
I've got multiple machines behind a NAT/firewall. I'd like to
ssh into those machines, so I map different incoming TCP/IP
port numbers to port 22 on the different hosts. That works
fine.

However, the ssh client is mad because n.n.n.n:8022 and
n.n.n.n:8023 are two different hosts. How do I get ssh to take
the port number into account in the know-hosts entries?

--
Grant Edwards grante Yow! KARL MALDEN'S NOSE
at just won an ACADEMY AWARD!!
visi.com
 
Reply With Quote
 
 
 
 
Grant Edwards
Guest
Posts: n/a

 
      04-29-2004, 07:50 PM
On 2004-04-29, Grant Edwards <(E-Mail Removed)> wrote:

> However, the ssh client is mad because n.n.n.n:8022 and
> n.n.n.n:8023 are two different hosts. How do I get ssh to take
> the port number into account in the know-hosts entries?


According to openssh's bugzilla database people have been
complaining about this for 2 years. So I guess I'm stuck.

--
Grant Edwards grante Yow! But they went to MARS
at around 1953!!
visi.com
 
Reply With Quote
 
/dev/rob0
Guest
Posts: n/a

 
      04-29-2004, 08:11 PM
On Thu, 29 Apr 2004 19:41:03 +0000, Grant Edwards wrote:
> However, the ssh client is mad because n.n.n.n:8022 and
> n.n.n.n:8023 are two different hosts. How do I get ssh to take
> the port number into account in the know-hosts entries?


I think you can turn off that host checking, or at least tone down the
objections. What I have done in this case: use a different hostname
(make a CNAME or another A record, or even an entry in /etc/hosts) and
consistently use that for the one on the alternate port.

If you have the opportunity to use more than one external IP, you could
DNAT each IP to a separate internal host, just leave them all on the
same port.
--
/dev/rob0 - preferred_email=i$((28*28+28))@softhome.net
or put "not-spam" or "/dev/rob0" in Subject header to reply

 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a

 
      04-29-2004, 08:27 PM
On 2004-04-29, /dev/rob0 <(E-Mail Removed)> wrote:

>> However, the ssh client is mad because n.n.n.n:8022 and
>> n.n.n.n:8023 are two different hosts. How do I get ssh to take
>> the port number into account in the know-hosts entries?

>
> I think you can turn off that host checking, or at least tone down the
> objections.


Yea, I guess a warning and a "continue?" would be workable.

> What I have done in this case: use a different hostname
> (make a CNAME or another A record, or even an entry in /etc/hosts) and
> consistently use that for the one on the alternate port.


Ah! So it does the lookup using the hostname you pass it
rather than the IP address to which it resolves? I hadn't
thought about that.

> If you have the opportunity to use more than one external IP,
> you could DNAT each IP to a separate internal host, just leave
> them all on the same port.


I've only got one IP address, but the multiple hostnames sounds
like it's worth trying.

--
Grant Edwards grante Yow! Is this BOISE??
at
visi.com
 
Reply With Quote
 
Grant Edwards
Guest
Posts: n/a

 
      04-29-2004, 09:10 PM
On 2004-04-29, Grant Edwards <(E-Mail Removed)> wrote:

> I've only got one IP address, but the multiple hostnames sounds
> like it's worth trying.


The trick is to go into the known-hosts file manually and fix
up the entries so that all of the "aliased" hostnames have the
form:

host1,nnn.nnn.nnn.nnn [...]
host2,nnn.nnn.nnn.nnn [...]
host3,nnn.nnn.nnn.nnn [...]
host4,nnn.nnn.nnn.nnn [...]

Otherwise, you seem to end up with only one entry with the IP
address on the end. Then, everytime you switch hosts, it
complains and moves the nnn.nnn.nnn.nnn. With entries like the
above, I get no warnings or complaints from ssh.

--
Grant Edwards grante Yow! Hello? Enema
at Bondage? I'm calling
visi.com because I want to be happy,
I guess...
 
Reply With Quote
 
David Efflandt
Guest
Posts: n/a

 
      04-30-2004, 04:38 AM
On 29 Apr 2004 20:27:12 GMT, Grant Edwards <(E-Mail Removed)> wrote:
> On 2004-04-29, /dev/rob0 <(E-Mail Removed)> wrote:
>
>>> However, the ssh client is mad because n.n.n.n:8022 and
>>> n.n.n.n:8023 are two different hosts. How do I get ssh to take
>>> the port number into account in the know-hosts entries?

>>
>> I think you can turn off that host checking, or at least tone down the
>> objections.

>
> Yea, I guess a warning and a "continue?" would be workable.
>
>> What I have done in this case: use a different hostname
>> (make a CNAME or another A record, or even an entry in /etc/hosts) and
>> consistently use that for the one on the alternate port.

>
> Ah! So it does the lookup using the hostname you pass it
> rather than the IP address to which it resolves? I hadn't
> thought about that.
>
>> If you have the opportunity to use more than one external IP,
>> you could DNAT each IP to a separate internal host, just leave
>> them all on the same port.

>
> I've only got one IP address, but the multiple hostnames sounds
> like it's worth trying.


Even if the public IP is dynamic, some dynamic DNS services (like
no-ip.com) can set up a wildcard A record (*.yourname.no-ip.com or one of
their other domains). The * can be any characters suitable for FQDN,
including additional dots. So you could use the port, or private hostname
or IP for the prefix.

--
David Efflandt - All spam ignored http://www.de-srv.com/
 
Reply With Quote
 
Ian Northeast
Guest
Posts: n/a

 
      04-30-2004, 08:36 PM
On Thu, 29 Apr 2004 19:41:03 +0000, Grant Edwards wrote:

> I've got multiple machines behind a NAT/firewall. I'd like to ssh into
> those machines, so I map different incoming TCP/IP port numbers to port 22
> on the different hosts. That works fine.
>
> However, the ssh client is mad because n.n.n.n:8022 and n.n.n.n:8023 are
> two different hosts. How do I get ssh to take the port number into
> account in the know-hosts entries?


Another possibility is to copy the key files from one machine to the
others so that they are all the same, then the client isn't aware that
it's connecting to different ones.

I do this when I dual boot the server and keep the IP address the same but
I don't see why it shouldn't work with different ones. As long as they're
all yours in the same LAN I can't see a security issue either.

Personally I just have the one server accessible from outside and ssh on
from that to the others as needed. It means I only have to worry about
security in one place. I've not found this inconvenient. I do the same at
work (there I have two, for redundancy, at different sites) and
there are hundreds of machines there I need to access remotely. Some of
which run OSs so ancient it would be difficult if not impossible to put a
secure SSH server on. Or even any SSH server at all. The SSH servers have
a telnet client (and a tn3270 one for those who remember what that's for

Regards, Ian

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Server 2008 with Hyper-V - domain controller - Firewall GUI's show firewall ON, but netsh reports firewall OFF Bruce Sanderson Windows Networking 7 10-07-2008 09:57 AM
Do I need a software firewall in addition to a NAT router/firewall? CRC Linux Networking 2 09-08-2008 02:16 AM
iptables-save using SNAT for machines behind firewall bl8n8r Linux Networking 0 05-11-2007 09:15 PM
Need to drop firewall for Win machines to connect via Samba. olczyk Linux Networking 2 12-16-2005 07:54 PM
Completely replace software firewall with hardware firewall? Sandi Broadband 36 04-04-2005 01:52 PM



1 2 3 4 5 6 7 8 9 10 11