I have the SSH server listening on my IP address in the guest machine (debian2)
edarabos@debian2:~$ telnet 172.16.100.128 22
Trying 172.16.100.128...
Connected to 172.16.100.128.
Escape character is '^]'.
SSH-2.0-OpenSSH_5.5p1 Debian-6
^]
telnet> close
Connection closed.
I can reach the host OS with ping.
edarabos@debian2:~$ ping -c 1 172.16.100.1
PING 172.16.100.1 (172.16.100.1) 56(84) bytes of data.
64 bytes from 172.16.100.1: icmp_req=1 ttl=128 time=0.243 ms
--- 172.16.100.1 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.243/0.243/0.243/0.000 ms
The host computer provides me with fine NAT (which I really need):
edarabos@debian2:~$ ssh computer.faraway.hu
!!! UTF-8 !!! 0mm
(|)-(|)
####### ########## ########## #########################
edarabos@computer.faraway.hu's password:
Linux computer 2.6.32-5-amd64 #1 SMP Tue Jun 14 09:42:28 UTC 2011 x86_64
You have mail.
Last login: Thu Sep 1 14:33:27 2011 from 257.257.257.257
16:13:49 up 2 days, 21:14, 5 users, load average: 0.00, 0.02, 0.00
edarabos@computer:~$
(edited for privacy)
My interface and routing configuration:
edarabos@debian2:~$ /sbin/ifconfig eth0 | grep "inet addr"
inet addr:172.16.100.128 Bcast:172.16.100.255 Mask:255.255.255.0
edarabos@debian2:~$ /sbin/route -n
Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
172.16.100.0 0.0.0.0 255.255.255.0 U 0 0 0 eth0
0.0.0.0 172.16.100.1 0.0.0.0 UG 0 0 0 eth0
When I try to use PuTTY to SSH to the guest OS (172.16.100.128) I get "Network error: Connection refused.". Doing tcpdump -vv
on the guest shows nothing when trying. It shows things when I SSH out to computer.faraway.hu.
The host is Win 7 32bit, VMWare Workstation 7.1.1. The guest is Debian Squeeze with non-tweaked kernel 2.6.32.
Google did not helped and I'm out of ideas.
UPDATE
I have a Cygwin on my Windows host and I have SSH on it which says:
$ ssh -vvv 172.16.100.128
OpenSSH_5.8p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /home/edarabos/.ssh/config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 172.16.100.128 [172.16.100.128] port 22.
debug1: connect to address 172.16.100.128 port 22: Connection refused
ssh: connect to host 172.16.100.128 port 22: Connection refused
UPDATE
Using telnet from host to guest:
C:\Users\edarabos>telnet 172.16.100.128 22
Connecting To 172.16.100.128...Could not open connection to the host, on port 22: Connect failed
Also, firewall service is not running on host. On the guest iptables -L
is empty and all policy is ACCEPT
.
UPDATE
I also configured a host-only VMnet and added a network interface to the guest accordingly. This interface (eth1) gets a proper IP address from the DHCP server on that VMnet. When I try to PuTTY from the host to that IP adress I get connection timeout. I also cannot ping the guest from the host.
I installed another guest with the same settings (cloned the first one). I can do SSH between the two guests. (The IPs of guests on that network are 172.16.101.2
and 172.16.101.3
).
Best Answer
Is sshd listening on 172.16.100.128 on the guest (linux) machine? -> grep Listen /etc/ssh/sshd.conf
[forget the above]
Summary:
The host OS only sees the outside interface of the NATted network, so you need to set up port forwarding to the NATted network in order to access one of the NATted hosts in that network, as there could be many hosts in there hidden behind one IP. (As is the case with any NATted network.)